VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / GetImages() Method
Syntax Example Requirements SeeAlso
In This Topic
    GetImages() Method (PdfDocument)
    In This Topic
    Returns a collection of image-resources of this PDF document.
    Syntax

    Return Value

    The collection that contains all image resources of this PDF document.
    Example

    Here is an example that shows how to obtain information about all image resources of PDF page:

    
    ''' <summary>
    ''' Prints information about image-resources of PDF document.
    ''' </summary>
    ''' <param name="pdfFilename">The filename of PDF document.</param>
    Public Shared Sub GetPdfImagesInfo(pdfFilename As String)
        ' open PDF document
        Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename)
            ' get collection of image-resources of PDF document
            Dim images As Vintasoft.Imaging.Pdf.Tree.PdfImageResource() = document.GetImages()
    
            ' print count of image-resource
            System.Console.WriteLine("Images count: {0}", images.Length)
    
            ' for each image-resource
            For Each image As Vintasoft.Imaging.Pdf.Tree.PdfImageResource In images
                ' print information about image-resource
                System.Console.WriteLine(vbTab & "{0,4}x{1,-4} {2,5}bpp {3}", image.Width, image.Height, image.BitsPerPixel, image.Compression)
            Next
        End Using
    End Sub
    
    ' This code example produces the following output:
      Images count: 11
        189x41      24bpp Jpeg
        120x50      24bpp Jpeg
        122x56      24bpp Jpeg
        143x41      24bpp Jpeg
        216x21      24bpp Jpeg
        106x49       8bpp Zip
        209x30      24bpp Jpeg
        189x24      24bpp Jpeg
        122x42      24bpp Jpeg
          5x7       24bpp Zip
        817x292     24bpp Jpeg
      
    
    
    
    
    /// <summary>
    /// Prints information about image-resources of PDF document.
    /// </summary>
    /// <param name="pdfFilename">The filename of PDF document.</param>
    public static void GetPdfImagesInfo(string pdfFilename)
    {
        // open PDF document
        using (Vintasoft.Imaging.Pdf.PdfDocument document = 
            new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename))
        {
            // get collection of image-resources of PDF document
            Vintasoft.Imaging.Pdf.Tree.PdfImageResource[] images = document.GetImages();
    
            // print count of image-resource
            System.Console.WriteLine("Images count: {0}", images.Length);
    
            // for each image-resource
            foreach (Vintasoft.Imaging.Pdf.Tree.PdfImageResource image in images)
            {
                // print information about image-resource
                System.Console.WriteLine("\t{0,4}x{1,-4} {2,5}bpp {3}", image.Width, image.Height,
                    image.BitsPerPixel, image.Compression);
            }
        }
    }
    
    /* This code example produces the following output:
    Images count: 11
      189x41      24bpp Jpeg
      120x50      24bpp Jpeg
      122x56      24bpp Jpeg
      143x41      24bpp Jpeg
      216x21      24bpp Jpeg
      106x49       8bpp Zip
      209x30      24bpp Jpeg
      189x24      24bpp Jpeg
      122x42      24bpp Jpeg
        5x7       24bpp Zip
      817x292     24bpp Jpeg
    */
    
    

    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