此版本的新功能
GroupDocs.Viewer for Java 25.12 引入了三項影響公共 API 的新功能、兩項增強以及八項錯誤修復。
| ID | 類別 | 摘要 |
|---|---|---|
| VIEWERNET‑5239 | 新功能 | 在將文件轉換為 HTML 時,可選擇性停用保留 JavaScript。 |
| VIEWERNET‑5486 | 新功能 | 為每個格式族引入不同的字體類型。 |
| VIEWERNET‑5484 | 新功能 | 在獲取 WordProcessing 系列格式的所有字體時,列出被替代的字體。 |
| VIEWERNET‑5490 | 改進 | 在將試算表文件轉換為嵌入式 HTML 時嵌入字體。 |
| VIEWERNET‑5475 | 改進 | 在將試算表文件渲染為 HTML 時支援「凍結首行」。 |
新的字體相關 API
此版本新增了針對族別的字體模型:
com.groupdocs.viewer.fonts.IFontInfo– 基礎介面。- 實作類別:
WordProcessingFontInfo、WordProcessingSubstitutedFontInfo、PdfFontInfo、SpreadsheetFontInfo、PresentationFontInfo。
先前的 com.groupdocs.viewer.fonts.UsedFontInfo 類別已被移除,且 FontStyles 已由 enum 改為功能完整的類別。
注意: 文件文章 * Getting all used fonts in the loaded document * 已重新撰寫,以說明這些變更。
試算表 → HTML 的嵌入字體
在使用工廠方法 HtmlViewOptions.forEmbeddedResources() 將試算表(.xls、.xlsx 等)渲染為 嵌入式 HTML 時,字體現在會自動嵌入(以 base‑64 編碼),除非明確將 isExcludeFonts() 標誌設為 true。
// Example: Convert a Spreadsheet to embedded HTML with fonts embedded
HtmlViewOptions options = HtmlViewOptions.forEmbeddedResources("output.html")
options.setExcludeFonts(false); // default is false
Viewer viewer = new Viewer("sample.xlsx");
viewer.view(options);
如果希望 HTML 輸出不包含嵌入字體,請呼叫 options.setExcludeFonts(true)。
錯誤修復與增強功能
| ID | 類別 | 摘要 |
|---|---|---|
| VIEWERNET‑5060 | 錯誤 | CustomTempFonts 資料夾在 .NET Framework 4.6.2 上持續增長(與 Java 無關,但已記錄)。 |
| VIEWERNET‑5145 | 錯誤 | 在將 PPTX 轉存為包含圖像的 HTML 時會出現合併字母。 |
| VIEWERNET‑5379 | 錯誤 | 將 PPTX 轉換為 HTML 時右下角缺少徽標。 |
| VIEWERNET‑5417 | 錯誤 | JPEG → PDF 轉換產生損壞的 PDF,於 Adobe Acrobat 開啟時出錯。 |
| VIEWERNET‑5378 | 錯誤 | 在 PDF → HTML 轉換過程中拋出例外。 |
| VIEWERNET‑5374 | 錯誤 | PDF 附件在渲染為 HTML 時格式錯誤。 |
| VIEWERNET‑5345 | 錯誤 | PDF → HTML 轉換時背景漸層渲染不正確。 |
| VIEWERNET‑3780 | 錯誤 | 無法載入某些 PSD 檔案。 |
| VIEWERNET‑5475 | 改進 | 在渲染試算表文件為 HTML 時加入「凍結首行」支援。 |
| VIEWERNET‑5490 | 改進 | 試算表 → 嵌入式 HTML 的嵌入字體(請參閱上方程式碼範例)。 |
公共 API 變更
新增
com.groupdocs.viewer.fonts.IFontInfo– 基礎介面。- 具體字體資訊類別:
WordProcessingFontInfoWordProcessingSubstitutedFontInfoPdfFontInfoSpreadsheetFontInfoPresentationFontInfo
com.groupdocs.viewer.fonts.FontStyles– 現已成為具備多項屬性的完整類別(之前為 enum)。
移除
com.groupdocs.viewer.fonts.UsedFontInfo– 已被IFontInfo階層取代。com.groupdocs.viewer.fonts.FontStylesenum – 已被新類別取代。
這些變更已在更新的 Javadoc 中反映,網址為 https://reference.groupdocs.com/viewer/java/.
如何獲取更新
此函式庫透過 Maven Central 發佈。將您的 pom.xml(或 Gradle 構建檔)更新至最新版本:
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-viewer</artifactId>
<version>25.12.0</version>
</dependency>
或者,從官方發行頁面下載已編譯的 JAR:
https://releases.groupdocs.com/viewer/java/new-releases/groupdocs-viewer-for-java-25-12/
資源
- 完整發行說明 – (請參閱您正在閱讀的頁面)
- 文件 – https://docs.groupdocs.com/viewer/java/
- 免費支援論壇 – https://forum.groupdocs.com/c/viewer/9