GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureDocumentConverter Class / SaveAsHTML Method / SaveAsHTML(Stream,HtmlLayoutType) Method
A stream object where the current document will be saved to as a HTML file. This stream object must be initialized before passing it to this method and it should stay open for subsequent use.

If the output stream is not opened for both reading and writing, the method will fail to return the GdPictureStatus.InvalidParameter status.

Example





In This Topic
SaveAsHTML(Stream,HtmlLayoutType) Method
In This Topic
This method converts the currently loaded document to HTML and saves it to an instantiated stream object.
Syntax
'Declaration
 
Public Overloads Function SaveAsHTML( _
   ByVal Stream As Stream, _
   ByVal layoutType As HtmlLayoutType _
) As GdPictureStatus
public GdPictureStatus SaveAsHTML( 
   Stream Stream,
   HtmlLayoutType layoutType
)
public function SaveAsHTML( 
    Stream: Stream;
    layoutType: HtmlLayoutType
): GdPictureStatus; 
public function SaveAsHTML( 
   Stream : Stream,
   layoutType : HtmlLayoutType
) : GdPictureStatus;
public: GdPictureStatus SaveAsHTML( 
   Stream* Stream,
   HtmlLayoutType layoutType
) 
public:
GdPictureStatus SaveAsHTML( 
   Stream^ Stream,
   HtmlLayoutType layoutType
) 

Parameters

Stream
A stream object where the current document will be saved to as a HTML file. This stream object must be initialized before passing it to this method and it should stay open for subsequent use.

If the output stream is not opened for both reading and writing, the method will fail to return the GdPictureStatus.InvalidParameter status.

layoutType

Return Value

A member of the GdPictureStatus enumeration. If processing is successful, then the return value is GdPictureStatus.OK.
Remarks
Note that the output stream should be open for both reading and writing and should be closed/disposed by the user once processing is complete.
Example
Converting and saving a PDF document to a HTML file using a stream.
using GdPicture14;
            
using GdPictureDocumentConverter converter = new();
            
var status = converter.LoadFromFile("input.pdf");
if (status != GdPictureStatus.OK)
{
    throw new Exception(status.ToString());
}
            
using var fs = new FileStream("output.html", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            
status = converter.SaveAsHTML(fs, HtmlLayoutType.PageLayout);
if (status != GdPictureStatus.OK)
{
    throw new Exception(status.ToString());
}
            
Console.WriteLine("The input document has been converted to a html file");
See Also