GroupDocs.Viewer for Python via .NET 24.7 Release Notes
In the previous version, we had to limit support for several file formats due to constraints on the package size for PyPI. After receiving approval from the support team, we are pleased to announce the release of the full version of the product, which now includes support for viewing all file formats specified in our documentation.
Additionally, here is a list of features included 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 |
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
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
with gv.Viewer("products.xlsx") as viewer:
viewOptions = gvo.PdfViewOptions("output.pdf")
viewOptions.spreadsheet_options = gvo.SpreadsheetOptions.for_rendering_print_area_and_page_breaks()
viewer.view(viewOptions)
# render spreadsheet into HTML
with gv.Viewer("products.xlsx") as viewer:
viewOptions = gvo.HtmlViewOptions.for_embedded_resources("page_{0}.html")
viewOptions.spreadsheet_options = gvo.SpreadsheetOptions.for_rendering_print_area_and_page_breaks()
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
load_options = gvo.LoadOptions()
load_options.skip_external_resources = True # Skip loading of external resources
with gv.Viewer("business-flyer.docx", load_options) as viewer:
viewOptions = gvo.HtmlViewOptions.for_embedded_resources()
viewer.view(viewOptions)
Skip loading external resources, except those with the “avatars.githubusercontent.com” segment in the URL
load_options = gvo.LoadOptions()
load_options.skip_external_resources = True # Skip loading of external resources
load_options.white_listed_resources.add("avatars.githubusercontent.com") # Enable loading of external resources that has 'avatars.githubusercontent.com' fragment in resource URL.
with gv.Viewer("business-flyer.docx", load_options) as viewer:
viewOptions = gvo.HtmlViewOptions.for_embedded_resources()
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, ensuring that the string passed to the SetLicense
method perfectly matches the file name included in the embedded resource.
# set license from embedded resource
license = gv.License()
license.set_license("GroupDocs.Viewer.lic")