Load from stream

You can load a document from a stream without saving it as a file on a disk. You can use this feature to load a document from different sources like a URL, FTP, and so on.

To load a document from a stream, follow these steps:

  1. Implement a method to get the document stream.
  2. Call the Viewer class constructor. Specify the method implemented in the previous step.

The following code snippet shows how to load a document from a stream:

stream = open("sample.docx", "rb")

# Render a document from the stream.
with gv.Viewer(stream) as viewer:
    options = gvo.HtmlViewOptions.for_embedded_resources("page_{0}.html")
    viewer.view(options)

Please refer to the following pages for examples: