VintaSoft Imaging .NET SDK 15.2: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
PdfDocument Class
In This Topic
Represents a PDF document.
Object Model
PdfDocumentCatalog PdfDocumentAdditionalActions PdfPageLabels PdfDocumentInteractiveForm PdfOptionalContentProperties PdfOptionalContentConfiguration PdfFontManager PdfDestinationBase PdfAction PdfEmbeddedFileSpecificationDictionary PdfAttachmentCollection PdfJavaScriptActionDictionary PdfFormat PdfDeveloperExtensionDictionary EncryptionSystem PdfDocumentInformation PdfPageCollection PdfBookmarkCollection DecodingSettings PdfRenderingSettings PdfDocumentViewerPreferences FontProgramsControllerBase PdfMarkInformation PdfStructureTreeRoot PdfDocument
Syntax
'Declaration

Public NotInheritable Class PdfDocument

public sealed class PdfDocument

Example

Here is an example that shows how to get information about PDF document:


Public Shared Sub GetInfoAboutPDF(filename As String)
    ' open PDF document
    Using document As New Vintasoft.Imaging.Pdf.PdfDocument(filename)
        ' show information about PDF document
        If document.IsEncrypted Then
            System.Console.WriteLine(String.Format("Encryption  : {0}", document.EncryptionSystem))
        End If
        System.Console.WriteLine(String.Format("Pages count : {0}", document.Pages.Count))
        System.Console.WriteLine(String.Format("Title       : {0}", document.DocumentInformation.Title))
        System.Console.WriteLine(String.Format("Author      : {0}", document.DocumentInformation.Author))
        System.Console.WriteLine(String.Format("Creator     : {0}", document.DocumentInformation.Creator))
        System.Console.WriteLine(String.Format("Producer    : {0}", document.DocumentInformation.Producer))
        System.Console.WriteLine(String.Format("Subject     : {0}", document.DocumentInformation.Subject))
        If document.DocumentInformation.CreationDate <> System.DateTime.MinValue Then
            System.Console.WriteLine(String.Format("CreationDate: {0}", document.DocumentInformation.CreationDate))
        End If
        If document.DocumentInformation.ModifyDate <> System.DateTime.MinValue Then
            System.Console.WriteLine(String.Format("ModifyDate  : {0}", document.DocumentInformation.ModifyDate))
        End If

        ' for each page of PDF document
        Dim page As Vintasoft.Imaging.Pdf.Tree.PdfPage
        For i As Integer = 0 To document.Pages.Count - 1
            ' show information about PDF page
            System.Console.WriteLine()
            page = document.Pages(i)
            System.Console.WriteLine(String.Format("Page {0}:", i))
            System.Console.WriteLine(String.Format(" - Size (in units)    = {0}", page.Size))
            System.Console.WriteLine(String.Format(" - Default Resolution = {0}", page.DefaultResolution))
            Dim images As Vintasoft.Imaging.Pdf.Tree.PdfImageResource() = page.GetImages()
            If images.Length > 0 Then
                System.Console.WriteLine(String.Format(" - Contains {0} images.", images.Length))
            End If
            If page.Thumbnail IsNot Nothing Then
                System.Console.WriteLine(" - Contains thumbnail.")
            End If
            If page.IsImageOnly Then
                System.Console.WriteLine(" - Is image only page.")
            End If
        Next
    End Using
End Sub


public static void GetInfoAboutPDF(string filename)
{
    // open PDF document
    using (Vintasoft.Imaging.Pdf.PdfDocument document = 
        new Vintasoft.Imaging.Pdf.PdfDocument(filename))
    {
        // show information about PDF document
        if (document.IsEncrypted)
            System.Console.WriteLine(string.Format("Encryption  : {0}", document.EncryptionSystem));
        System.Console.WriteLine(string.Format("Pages count : {0}", document.Pages.Count));
        System.Console.WriteLine(string.Format("Title       : {0}", document.DocumentInformation.Title));
        System.Console.WriteLine(string.Format("Author      : {0}", document.DocumentInformation.Author));
        System.Console.WriteLine(string.Format("Creator     : {0}", document.DocumentInformation.Creator));
        System.Console.WriteLine(string.Format("Producer    : {0}", document.DocumentInformation.Producer));
        System.Console.WriteLine(string.Format("Subject     : {0}", document.DocumentInformation.Subject));
        if (document.DocumentInformation.CreationDate != System.DateTime.MinValue)
            System.Console.WriteLine(string.Format("CreationDate: {0}", document.DocumentInformation.CreationDate));
        if (document.DocumentInformation.ModifyDate != System.DateTime.MinValue)
            System.Console.WriteLine(string.Format("ModifyDate  : {0}", document.DocumentInformation.ModifyDate));

        // for each page of PDF document
        Vintasoft.Imaging.Pdf.Tree.PdfPage page;
        for (int i = 0; i < document.Pages.Count; i++)
        {
            // show information about PDF page
            System.Console.WriteLine();
            page = document.Pages[i];
            System.Console.WriteLine(string.Format("Page {0}:", i));
            System.Console.WriteLine(string.Format(" - Size (in units)    = {0}", page.Size));
            System.Console.WriteLine(string.Format(" - Default Resolution = {0}", page.DefaultResolution));
            Vintasoft.Imaging.Pdf.Tree.PdfImageResource[] images = page.GetImages();
            if (images.Length > 0)
                System.Console.WriteLine(string.Format(" - Contains {0} images.", images.Length));
            if (page.Thumbnail != null)
                System.Console.WriteLine(" - Contains thumbnail.");
            if (page.IsImageOnly)
                System.Console.WriteLine(" - Is image only page.");
        }
    }
}

Inheritance Hierarchy

System.Object
   Vintasoft.Imaging.Pdf.PdfDocument

Requirements

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

See Also