Document Output
DynamicPDF Generator for .NET can output PDF documents to a file, web form, byte array or any System.IO.Stream object that supports writing. The Draw and DrawToWeb methods of the Document class handle all document output. These methods are overloaded and give many options for the output of the PDF document.
Output to an ASPX page (WebForm)
From the On_Load event of the WebForm the Document's DrawToWeb method can be called and passed in a download file name.
// Outputs the PDF document to the page object.
document.DrawToWeb( pdfFilePath );
' Outputs the PDF document to the page object.
MyDocument.DrawToWeb( pdfFilePath )
By using the DrawToWeb method and passing in a True boolean value, this will force the document to be manually saved to the end user's machine instead of being viewed in the browser.
// Outputs the PDF document to the page object.
document.DrawToWeb( pdfFilePath, true );
' Outputs the PDF document to the page object.
MyDocument.DrawToWeb( pdfFilePath, True )
Output to a file
Specify the file path and name for the file in the Document's Draw method.
// Outputs the PDF document to a file.
document.Draw( pdfFilePath );
' Outputs the PDF document to a file.
MyDocument.Draw( pdfFilePath )
Output to a System.IO.Stream object
Specify the Stream object to receive the output in the Document's Draw method.
// Outputs the PDF document to a stream.
document.Draw( stream );
' Outputs the PDF document to a byte array.
Dim MyData As Byte()
MyData = MyDocument.Draw()