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

PdfDocumentProcessor.CreateBitmap(Int32, Int32) Method

Exports a PDF page to a bitmap image.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v21.2.dll

Declaration

public Bitmap CreateBitmap(
    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
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).

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

The following example illustrates how to convert pages to bitmap images.

View Example

using DevExpress.Pdf;
using System.Drawing;

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.
          Bitmap image = processor.CreateBitmap(i, largestEdgeLength);

          // Save the bitmaps.
          image.Save("..\\..\\MyBitmap" + i + ".bmp");
      }
  }

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateBitmap(Int32, Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also