VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс PdfDocument
    В этом разделе
    Представляет PDF документ.
    Объектная модель
    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
    Синтаксис
    'Declaration
    
    Public NotInheritable Class PdfDocument
    
    
    public sealed class PdfDocument
    
    
    public __gc __sealed class PdfDocument
    
    
    public ref class PdfDocument sealed
    
    
    Пример

    Вот пример, показывающий, как получить информацию о PDF документе:

    
    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.");
            }
        }
    }
    
    

    Иерархия наследования

    System.Object
       Vintasoft.Imaging.Pdf.PdfDocument

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также