Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfDocumentProcessor.CreateDXBitmap(Int32, Int32) Method

Exports a PDF page to a bitmap image. Use this method in non-Windows environments.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v24.2.dll

NuGet Package: DevExpress.Document.Processor

#Declaration

public DXBitmap CreateDXBitmap(
    int pageNumber,
    int largestEdgeLength
)

#Parameters

Name Type Description
pageNumber Int32

A page number.

largestEdgeLength Int32

A length of the image’s largest dimension, in pixels.

#Returns

Type Description
DXBitmap

The converted page.

#Remarks

The largestEdgeLength parameter determines the output image height for pages in the portrait orientation and width – for landscape pages. The page is proportionally scaled so that the largest edge of the converted bitmap is equal to the largestEdgeLength value.

You can reduce the output image size and memory consumption if you pass a smaller largestEdgeLength value to the CreateBitmap method.

#Example

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);
        }
    }
}
See Also