VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / PdfDocument Constructors / PdfDocument Constructor(String,PdfFormat)
Syntax Exceptions Remarks Example Requirements SeeAlso
In This Topic
    PdfDocument Constructor(String,PdfFormat)
    In This Topic
    Initializes a new instance of the PdfDocument class.
    Syntax
    'Declaration
    
    Public Function New( _
    ByVal filename
    File name of the new PDF document.
    As System.String, _
    ByVal format
    Format of new PDF document.
    As PdfFormat _
    )
    public PdfDocument(
    System.String filename,
    PdfFormat format
    )
    public: PdfDocument(
    System.String filename,
    PdfFormat* format
    )
    public:
    PdfDocument(
    System.String filename,
    PdfFormat^ format
    )

    Parameters

    filename
    File name of the new PDF document.
    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 in read-write mode.

    Example

    Here is an example that shows how to create an empty PDF/A document version 1.4 in a file:

    
    Public Shared Sub CreatePdfADocumentInFile(pdfFilename As String, pageImage As String)
        ' create new PDF document version 1.4
        Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14)
            ' create an image
            Using image As New Vintasoft.Imaging.VintasoftImage(pageImage)
                ' add image to PDF document
                document.Pages.Add(image)
            End Using
    
            ' convert documen to PDF/A-1b
            document.ConvertDocument(Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b)
        End Using
    End Sub
    
    
    
    public static void CreatePdfADocumentInFile(string pdfFilename, string pageImage)
    {
        // create new PDF document version 1.4
        using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(
            pdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14))
        {
            // create an image
            using (Vintasoft.Imaging.VintasoftImage image = new Vintasoft.Imaging.VintasoftImage(pageImage))
            {
                // add image to PDF document
                document.Pages.Add(image);
            }
    
            // convert documen to PDF/A-1b
            document.ConvertDocument(Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b);
        }
    }
    
    

    Requirements

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

    See Also