VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / PdfDocument Constructors / PdfDocument Constructor(PdfFormat)
Syntax Exceptions Remarks Example Requirements SeeAlso
In This Topic
PdfDocument Constructor(PdfFormat)
In This Topic
Initializes a new instance of the PdfDocument class.
Syntax
'Declaration

Public Function New( _
ByVal format
Format of new PDF document.
As PdfFormat _
)
public PdfDocument(
PdfFormat format
)

Parameters

format
Format of new PDF document.
Exceptions
ExceptionDescription
Thrown if format is Pdf_A. Use ConvertDocument(PdfDocumentConformance) method to convert document to PDF/A.
Remarks

This constructor creates new PDF document of specified format.

Example

Here is an example that shows how to create an empty PDF document version 1.4 in the memory and save it to a file:


Public Shared Sub CreatePdfDocumentInMemory(images As Vintasoft.Imaging.ImageCollection)
    ' create new PDF document version 1.4 in the memory
    Using document As New Vintasoft.Imaging.Pdf.PdfDocument(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.Save("doc.pdf")
    End Using
End Sub


public static void CreatePdfDocumentInMemory(Vintasoft.Imaging.ImageCollection images)
{
    // create new PDF document version 1.4 in the memory
    using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(
        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.Save("doc.pdf");
    }
}

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also