The method that instantiates a stream used to write output page data.
create_resource_stream
CreateResourceStream
The method that instantiates a stream used to write output HTML resource data.
create_resource_url
CreateResourceUrl
The method that creates a URL for an HTML resource.
release_page_stream
ReleasePageStream
The method that releases the stream created by the delegate passed to create_page_stream.
release_resource_stream
ReleaseResourceStream
The method that releases the stream created by the delegate passed to create_resource_stream.
Returns: HtmlViewOptions: New instance of the HtmlViewOptions class for rendering into HTML with external resources.
Raises
Description
ValueError
When release_resource_stream is None.
Example
fromgroupdocs.viewerimportViewerfromgroupdocs.viewer.optionsimportHtmlViewOptionsdefrender_excel_to_html_external():# Load Excel spreadsheetwithViewer("invoice.xlsx")asviewer:# Convert the spreadsheet to HTML with external resources.# {0} and {1} are replaced with the current page number and resource name, respectively.view_options=HtmlViewOptions.for_external_resources("render_excel_to_html_external/pdf_page_{0}.html","render_excel_to_html_external/pdf_page_{0}/resource_{0}_{1}","render_excel_to_html_external/pdf_page_{0}/resource_{0}_{1}")viewer.view(view_options)if__name__=="__main__":render_excel_to_html_external()
for_external_resources
Initializes an HtmlViewOptions instance for rendering into HTML with external resources.
The factory that implements methods for creating and releasing the output page stream.
resource_stream_factory
IResourceStreamFactory
The factory that implements methods required for creating resource URLs, instantiating, and releasing output HTML resource streams.
Returns: HtmlViewOptions: A new HtmlViewOptions instance configured for external resources.
Raises
Description
ValueError
If resource_stream_factory is None.
Example
fromgroupdocs.viewerimportViewerfromgroupdocs.viewer.optionsimportHtmlViewOptionsdefrender_to_html_external():# Create an HTML file for each page and store external resources separately.# {0} and {1} are replaced with the current page number and resource name, respectively.withViewer("sample.docx")asviewer:html_options=HtmlViewOptions.for_external_resources("page_{0}.html","page_{0}/resource_{0}_{1}","page_{0}/resource_{0}_{1}")viewer.view(html_options)if__name__=="__main__":render_to_html_external()
for_external_resources
Initializes an HtmlViewOptions instance configured to generate HTML files with external resources.
The instance uses the provided format strings:
html_file_path_format – file path format for the output HTML files (e.g., "page_{0}.html").
resources_path_format – folder path format for external resource files (e.g., "page_{0}/resource_{0}_{1}").
resources_url_format – URL format for HTML resources (e.g., "page_{0}/resource_{0}_{1}").
The output files are placed in the current working directory of the application.
deffor_external_resources(cls):...
Returns: HtmlViewOptions: Configured options for rendering HTML with external resources.
The resource file path format, e.g. 'page_{0}/resource_{1}'.
resource_url_format
str
The resource URL format, e.g. 'page_{0}/resource_{1}'.
Raises
Description
ValueError
If resource_url_format is None or empty.
Example
fromgroupdocs.viewerimportViewerfromgroupdocs.viewer.optionsimportHtmlViewOptionsdefrender_to_html_external():# Load a document and render each page to an HTML file with external resources.withViewer("sample.docx")asviewer:html_options=HtmlViewOptions.for_external_resources("page_{0}.html","page_{0}/resource_{0}_{1}","page_{0}/resource_{0}_{1}")viewer.view(html_options)if__name__=="__main__":render_to_html_external()