Back to Devexpress

How to: Use PDF Document API to Export a PDF File Pages to Bitmap Images

officefileapi-120344-pdf-document-api-examples-export-a-pdf-document-to-an-image-how-to-export-a-pdf-document-to-a-bitmap.md

latest2.5 KB
Original Source

How to: Use PDF Document API to Export a PDF File Pages to Bitmap Images

  • Sep 22, 2025
  • 2 minutes to read

Important

You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use these examples in production code.

Follow the steps below to export pages to bitmap images:

  • Create a PdfDocumentProcessor instance and call the LoadDocument method to load a file.
  • Call the PdfDocumentProcessor.CreateDXBitmap method, and pass the page number and the largestEdgeLength parameter (measured in pixels) as parameters. The largestEdgeLength parameter determines the output image’s height for pages in the portrait orientation and width for landscape pages.

Tip

Pass the PdfPageRenderingParameters instance as the CreateDXBitmap method parameter to specify a predefined resolution for a PDF page exported to a Bitmap image.

csharp
using DevExpress.Drawing;
using DevExpress.Pdf;

static void Main(string[] args) {

    int largestEdgeLength = 1000;

    using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {
        // Load a document.
        processor.LoadDocument("..\\..\\Document.pdf");

        for (int i = 1; i <= processor.Document.Pages.Count; i++) {
            // Export pages to bitmaps.
            DXBitmap image = processor.CreateDXBitmap(i, largestEdgeLength);

            // Save the bitmaps.
            image.Save("..\\..\\MyBitmap" + i + ".bmp", DXImageFormat.Bmp);
        }
    }
}
vb
Imports DevExpress.Drawing
Imports DevExpress.Pdf

Shared Sub Main(ByVal args() As String)

    Dim largestEdgeLength As Integer = 1000

    Using processor As New PdfDocumentProcessor()
        ' Load a document.
        processor.LoadDocument("..\..\Document.pdf")

        For i As Integer = 1 To processor.Document.Pages.Count
            ' Export pages to bitmaps.
            Dim image As DXBitmap = processor.CreateDXBitmap(i, largestEdgeLength)

            ' Save the bitmaps.
            image.Save("..\..\MyBitmap" & i & ".bmp", DXImageFormat.Bmp)
        Next i
    End Using
End Sub