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:
Implement a method to get the document stream.
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:
usingSystem.IO;usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...Streamstream=GetStream("sample.docx");// TODO: implement this method// Render a document from the stream.using(Viewerviewer=newViewer(stream)){HtmlViewOptionsviewOptions=HtmlViewOptions.ForEmbeddedResources();viewer.View(viewOptions);}
ImportsSystem.IOImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())DimstreamAsStream=GetStream("sample.docx")' TODO: implement this method
' Render a document from the stream.
UsingviewerAsViewer=NewViewer(stream)DimviewOptionsAsHtmlViewOptions=HtmlViewOptions.ForEmbeddedResources()viewer.View(viewOptions)EndUsingEndSubEndModule