PdfDocument Constructor(Stream,PdfFormat)
Initializes a new instance of the
PdfDocument class from the specified stream.
This constructor opens an existing PDF document from the stream with access mode of the stream if stream length is 0.
This constructor creates new PDF document in the stream if stream length is 0. Stream must have read-write access.
Here is an example that shows how to create an empty PDF document version 1.4 in a stream:
Public Sub CreatePdfDocumentInStream(stream As System.IO.Stream)
' create new PDF document version 1.4 in the memory
Using document As New Vintasoft.Imaging.Pdf.PdfDocument(stream, New Vintasoft.Imaging.Pdf.PdfFormat("1.4"))
' create an empty image
Using image As New Vintasoft.Imaging.VintasoftImage(600, 800)
' add image to PDF document
document.Pages.Add(image)
End Using
' save document to a file
document.SaveChanges()
End Using
End Sub
public void CreatePdfDocumentInStream(System.IO.Stream stream)
{
// create new PDF document version 1.4 in the memory
using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(
stream, new Vintasoft.Imaging.Pdf.PdfFormat("1.4")))
{
// create an empty image
using (Vintasoft.Imaging.VintasoftImage image = new Vintasoft.Imaging.VintasoftImage(600, 800))
{
// add image to PDF document
document.Pages.Add(image);
}
// save document to a file
document.SaveChanges();
}
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5