此版本新增內容
GroupDocs.Viewer for Node.js via Java 25.12(2025 年 12 月)新增四項改進與一項錯誤修正。這些變更著重於讓函式庫與最新的執行時版本保持一致、提升開發者體驗,並修復一個關鍵的光柵轉換問題。
| 項目 | 類別 | 摘要 |
|---|---|---|
| VIEWERNODEJS‑174 | 改進 | 完全支援最新受支援的 Node.js 與 Java 版本 — 已更新核心相依性,並確認與目前的 LTS 版本相容。 |
| VIEWERNODEJS‑176 | 改進 | 文件與 GitHub 範例程式碼已同步;加入了日誌功能,且範例遵循與文件相同的結構。 |
| VIEWERNODEJS‑177 | 改進 | 文件中的所有程式碼片段已轉換為 獨立且可直接執行的腳本 — 無需額外匯入或設定步驟。 |
| VIEWERNODEJS‑178 | 改進 | 新增「Running in Docker」文件主題,指導您在 CI/CD 流程中將 GroupDocs.Viewer 容器化。 |
| VIEWERNODEJS‑70 | 錯誤修正 | 修正了先前產生空白白色圖像的 EPS → JPG 轉換。現在在 Windows 與 Linux 上皆能正確呈現 EPS 內容。 |
主要功能亮點
- EPS 轉 JPG 的修正 – 為 EPS 文件提供可靠的光柵輸出。
- 支援最新的 Node.js 與 Java – 與現代建構工具無縫整合。
- 同步且獨立的程式碼範例 – 可直接複製貼上的腳本加速上手。
程式碼範例
1. 將文件渲染為嵌入式資源 HTML(獨立腳本)
import { Viewer, HtmlViewOptions } from '@groupdocs/groupdocs.viewer';
// Input document to render
const viewer = new Viewer('resume.docx');
// Output configuration:
// - Embedded resources produces a single self‑contained HTML per page.
// - "page_{0}.html" is a filename pattern where {0} is the page number.
const viewOptions = HtmlViewOptions.forEmbeddedResources('page_{0}.html');
// Render document pages to HTML
viewer.view(viewOptions);
此範例 (VIEWERNODEJS‑177) 示範了新重構、可直接複製貼上的腳本,開箱即用。
2. 將 EPS 轉換為 JPG(修正錯誤)
import { Viewer, License, JpgViewOptions } from '@groupdocs/groupdocs.viewer';
// Optional: apply your license before rendering
const license = new License();
license.setLicense('GroupDocs.Viewer.lic');
// Input EPS document
const viewer = new Viewer('sample.eps');
// Output configuration: render each page to a JPEG file using the pattern below
const viewOptions = new JpgViewOptions('page_{0}.jpg');
// Render EPS pages to JPG
viewer.view(viewOptions);
// Optional: exit explicitly in short‑lived scripts/CI jobs
process.exit(0);
現在 EPS → JPG 流程會產生正確的圖像 (VIEWERNODEJS‑70)。
如何取得更新
# Install the latest 25.12 package from npm
npm install @groupdocs/groupdocs.viewer@25.12
提示: 此套件相容於目前的 Node.js 與 Java LTS 版本。若用於容器化工作流程,請參考以下 Docker 指南。
資源
- GitHub 程式碼範例 – https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java
- 系統需求 – https://docs.groupdocs.com/viewer/nodejs-java/system-requirements/
- 在 Docker 中執行 – https://docs.groupdocs.com/viewer/nodejs-java/running-in-docker/
- 安裝指南 – https://docs.groupdocs.com/viewer/nodejs-java/installation/
- 免費支援論壇 – https://forum.groupdocs.com/c/viewer/9