Skip to main content
A newer version of this page is available. .
.NET Standard 2.0+

PdfDocumentProcessor.GetImages(PdfDocumentArea) Method

Retrieves the images found within the specified document area.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v19.1.dll

Declaration

public IList<Bitmap> GetImages(
    PdfDocumentArea area
)

Parameters

Name Type Description
area PdfDocumentArea

A PdfDocumentArea object.

Returns

Type Description
IList<Bitmap>

A collection of Bitmap objects.

Remarks

The overloaded GetImages method uses the page coordinate system. See the Coordinate Systems topic to learn more.

The GetImages method does not work in Partial Trust environments and requires the Full Trust permission level.

Important

The GetImages method uses GDI/GDI+ rendering and works only on Windows OS. The PlatformNotSupportedException is thrown on other operating systems.

Example

This example illustrates the use of the PdfDocumentProcessor.GetImages method for obtaining document bitmaps in code by using PDF Document API.

Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports DevExpress.Pdf
' ...
        Shared Sub Main(ByVal args() As String)
            Dim processor As New PdfDocumentProcessor()
            processor.LoadDocument("..\\..\\Demo.pdf")

            Dim xCount As Integer = 8
            Dim yCount As Integer = 2
            Dim cardWidth As Double = 150.5 ' Measured in points (equals 2.09 inches).
            Dim cardHeight As Double = 442 ' Measured in points (equals 6.138 inches).
            Dim xMargin As Double = 122 ' Measured in points (equals 1.694 inches).
            Dim yMargin As Double = 77 ' Measured in points (equals 1.069 inches).
            Dim yCoord As Double = yMargin

            Dim y As Integer = 0
            Do While y < yCount
                Dim xCoord As Double = xMargin
                Dim x As Integer = 0
                Do While x < xCount
                    Dim area As New PdfDocumentArea(1, New PdfRectangle(xCoord, yCoord, xCoord + cardWidth, yCoord + cardHeight))
                    Dim bitmaps As IList(Of Bitmap) = processor.GetImages(area)
                    If bitmaps.Count <> 0 Then
                        bitmaps(0).Save(String.Format("{0}_{1}.bmp", x, y))
                        bitmaps(0).Dispose()
                    End If
                    Console.WriteLine(bitmaps.Count.ToString())
                    x += 1
                    xCoord += cardWidth
                Loop
                y += 1
                yCoord += cardHeight
            Loop
        End Sub
See Also