VintaSoft Imaging .NET SDK 12.5: Документация для .NET разработчика
В этом разделе
    PDF: Работа с PDF документом
    В этом разделе
    Класс PdfDocument представляет собой PDF документ и позволяет:


    Вот C#/VB.NET код, который демонстрирует, как получить информацию о PDF документе:
    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.");
            }
        }
    }
    
    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