Skip to main content
A newer version of this page is available. .
All docs
V21.2
.NET Framework 4.5.2+

PdfDocumentProcessor.CreateBitmap(Int32, PdfPageRenderingParameters) Method

Exports a PDF page to a bitmap image with specified rendering parameters.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v21.2.dll

Declaration

public Bitmap CreateBitmap(
    int pageNumber,
    PdfPageRenderingParameters options
)

Parameters

Name Type Description
pageNumber Int32

A page number.

options PdfPageRenderingParameters

An object that contains page rendering parameters.

Returns

Type Description
Bitmap

The converted page.

Remarks

Note

Set the RenderingEngine property to Skia to enable this method on Azure Web Apps, Linux, or Mac OS. To use the Skia rendering engine, add a reference to the DevExpress.Pdf.SkiaRenderer package or the DevExpress.Pdf.SkiaRenderer.v21.2 library reference with the SkiaSharp package (v1.68 if you use .NET Framework 4.5 and v2.80 for .NET Standard).

This CreateBitmap method overload allows you to specify a DPI for an exported Bitmap image. Call the PdfPageRenderingParameters.CreateWithResolution(Single) method to create a new PdfPageRenderingParameters instance with the specified image DPI and pass it as the CreateBitmap method parameter.

The code sample below exports the first PDF page to an image, and saves the image to a file:

using (var pdfDocumentProcessor = new PdfDocumentProcessor())
{
    pdfDocumentProcessor.LoadDocument(@"Documents\Example.pdf");
    PdfPageRenderingParameters parameters =
       PdfPageRenderingParameters.CreateWithResolution(300);
    pdfDocumentProcessor.CreateBitmap(1, parameters).Save("..\\..\\MyBitmap.bmp");
}
See Also