GroupDocs.Viewer for Java 24.6 Release Notes
Full list of changes in this release
Key | Category | Summary |
---|---|---|
VIEWERNET‑4289 | Feature | Rendering Excel spreadsheets by page break and print area |
VIEWERNET‑4360 | Feature | Skip loading of external resources referenced by documents |
VIEWERNET‑4538 | Feature | Add support for reading license from embedded resources |
VIEWERNET‑4491 | Fix | Object reference not set to an instance of an object exception when calling getViewInfo and getFileInfo methods |
VIEWERNET‑4484 | Fix | Viewer Horizontal Scrolling Not Working on Excel |
VIEWERNET‑4237 | Fix | Colour gradients lost in Vectors |
VIEWERNET‑4209 | Fix | PdfOptions#setRenderTextAsImage(false) causes slow loading |
VIEWERNET‑2277 | Fix | Resource loading timeout is not working |
VIEWERNET‑3430 | Fix | “Font embedding is prohibited because of font license restrictions” exception when rendering OXPS file |
VIEWERNET‑2700 | Fix | Null reference exception when Load and Save Epub/PDF document to PDF without license in Linux |
VIEWERJAVA‑3107 | Fix | Application is freezing when opening specific ‘ai’ file |
VIEWERJAVA‑3114 | Fix | Rendering AI file takes much time and the result is completely black |
VIEWERJAVA‑3149 | Fix | Setting default font name does not work when rendering tasks file to HTML with embedded resources |
VIEWERJAVA‑3150 | Fix | Setting default font name does not work when rendering tasks file to HTML with external resources |
VIEWERJAVA‑3280 | Fix | Auto fit column does not work when rendering Cells document to HTML with embedded resources |
VIEWERJAVA‑3289 | Fix | Auto fit column does not work when rendering Cells document to HTML with external resources |
VIEWERJAVA‑3426 | Fix | “Parsing of table ‘GPOS’ has failed.” error appeared when rendering a specific Slides document |
Major Features
This release includes the following features:
- The rendering of the Excel spreadsheets using page breaks and print areas added
- The ability to skip loading of external resources referenced by documents added
- Add support for reading license from embedded resources
- Skip embedded font license verification in XPS and OXPS files
- Enclose images in SVG when rendering PDF and Page Layout files
The rendering of the Excel spreadsheets using page break and print area
Now, you can split the printable area into multiple pages, similar to Excel’s printing function. This feature lets you separate pages based on included page breaks in the printable area. To do this, call the SpreadsheetOptions.ForRenderingPrintAreaAndPageBreaks method. For details, see the Split a worksheet into pages page.
//render spreadsheet into PDF
try (Viewer viewer = new Viewer("products.xlsx")) {
PdfViewOptions viewOptions = new PdfViewOptions("output.pdf");
viewOptions.setSpreadsheetOptions(SpreadsheetOptions.forRenderingPrintAreaAndPageBreaks());
viewer.view(viewOptions);
}
//render spreadsheet into HTML
try (Viewer viewer = new Viewer("products.xlsx")) {
HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources("page_{0}.html");
viewOptions.setSpreadsheetOptions(SpreadsheetOptions.forRenderingPrintAreaAndPageBreaks());
viewer.view(viewOptions);
}
Skip loading of external resources referenced by documents
We introduced the SkipExternalResources and WhitelistedResources properties of the LoadOptions class. These options enable you to skip downloading all external resources or create an allowlist to download resources with specific URLs. For details, see the Loading of external resources containing by a document page.
Skip loading all external resources
LoadOptions loadOptions = new LoadOptions();
loadOptions.setSkipExternalResources(true); // Skip loading of external resources
try (Viewer viewer = new Viewer("business-flyer.docx", loadOptions)) {
HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
viewer.view(viewOptions);
}
Skip loading external resources, except those with the “avatars.githubusercontent.com” segment in the URL
LoadOptions loadOptions = new LoadOptions();
loadOptions.setSkipExternalResources(true); // Skip loading of external resources
loadOptions.getWhitelistedResources().add("avatars.githubusercontent.com"); //Enable loading of external resources that has 'avatars.githubusercontent.com' fragment in resource URL.
try (Viewer viewer = new Viewer("business-flyer.docx", loadOptions)) {
HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
viewer.view(viewOptions);
}
Add support for reading license from embedded resources
When utilizing an embedded license, you can specify the license name. It’s essential to include the license file as an embedded resource within your project. Subsequently, you can exclusively reference the license by its name and package, ensuring that the string passed to the setLicense
method perfectly matches the file and package name included in the embedded resource.
// set license from embedded resource
License license = new License();
license.setLicense("com/sample/GroupDocs.Viewer.lic");
Skip font license verification when rendering XPS and OXPS files
If an XPS or OXPS file contains a font that cannot be embedded due to licensing restrictions, GroupDocs.Viewer throws an exception at runtime. If you have a license for this font, enable the PdfOptions#setDisableFontLicenseVerifications(true) option to skip font license verification.
For details, see documentation.
try (Viewer viewer = new Viewer("resume.oxps")) {
HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
viewOptions.getPdfOptions().setDisableFontLicenseVerifications(true);
viewer.view(viewOptions);
}
Enclose images in SVG when rendering PDF and Page Layout files
By default, when rendering to the PDF and Page Layout file formats, all images are combined into a single PNG file, which serves as the background for the output HTML document.
The PdfOptions#setWrapImagesInSvg(…) option allows you to wrap each image in the output HTML document with an SVG tag to improve output quality.
This option is available when rendering PDF and Page Layout file formats to HTML with embedded or external resources.
For details, see documentation.
try (Viewer viewer = new Viewer("resume.pdf")) {
HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setWrapImagesInSvg(true);
viewOptions.setPdfOptions(pdfOptions);
viewer.view(viewOptions);
}
The following image shows the rendering resume.pdf with the disabled (left) and enabled (right) WrapImagesInSvg
option. The image on the right has better quality compared to the image on the left: