PdfDocumentProcessor.CreateBitmap(Int32, PdfPageRenderingParameters) Method
Exports a PDF page to a bitmap image with specified rendering parameters.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Docs.v24.2.dll
NuGet Package: DevExpress.Document.Processor
#Declaration
public Bitmap CreateBitmap(
int pageNumber,
PdfPageRenderingParameters options
)
#Parameters
Name | Type | Description |
---|---|---|
page |
Int32 | A page number. |
options | Pdf |
An object that contains page rendering parameters. |
#Returns
Type | Description |
---|---|
Bitmap | The converted page. |
#Remarks
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.
Warning
The Create
method uses GDI/GDI+ rendering and works only on Windows OS. The Platform
is thrown on other operating systems. Use the Create
method in non-Windows environments.
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");
}