General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
PdfDocumentProcessor.CreateBitmap(Int32, Int32) Method
Exports a PDF page to a bitmap image.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Docs.v19.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
pageNumber | Int32 | An integer value, specifying the converted page's number. |
largestEdgeLength | Int32 | An integer value, specifying the length of the image's largest dimension, in pixels. |
Parameters
Name | Type | Description |
---|---|---|
pageNumber | Int32 | An integer value, specifying the converted page's number. |
largestEdgeLength | Int32 | An integer value, specifying the length of the image's largest dimension, in pixels. |
Parameters
Name | Type | Description |
---|---|---|
pageNumber | Int32 | An integer value, specifying the converted page's number. |
largestEdgeLength | Int32 | An integer value, specifying the length of the image's largest dimension, in pixels. |
Remarks
Note
The CreateBitmap method works on Azure Windows Virtual Machines and does not work on Azure Web Apps.
The CreateBitmap method has two parameters: the converted page's number and the length of the image's largest dimension in pixels. The latter parameter determines the output image height for pages in the portrait orientation and width - for landscape pages.
You can reduce the output image size and memory consumption if you pass a smaller largestEdgeLength value to the CreateBitmap method. The document page will not be clipped when it is converted to bitmap. The page will be proportionally scaled so that the largest edge of the converted bitmap is equal to the largestEdgeLength value.
Important
The CreateBitmap method uses GDI/GDI+ rendering and works only on Windows OS. The PlatformNotSupportedException is thrown on other operating systems.
Example
The following example illustrates how to convert pages to bitmap images.
Note
The complete sample project is available at https://github.com/DevExpress-Examples/how-to-export-a-pdf-document-to-multi-page-tiff-and-bitmap
using DevExpress.Pdf;
using System.Drawing;
namespace ExportToBitmap {
class Program {
static void Main(string[] args) {
int largestEdgeLength = 1000;
// Create a PDF Document Processor.
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");
}
}
}
}
}
Imports DevExpress.Pdf
Imports System.Drawing
Namespace ExportToBitmap
Class Program
Private Shared Sub Main(ByVal args As String())
Dim largestEdgeLength As Integer = 1000
Using processor As PdfDocumentProcessor = New PdfDocumentProcessor()
processor.LoadDocument("..\..\Document.pdf")
For i As Integer = 1 To processor.Document.Pages.Count
Dim image As Bitmap = processor.CreateBitmap(i, largestEdgeLength)
image.Save("..\..\MyBitmap" & i & ".bmp")
Next
End Using
End Sub
End Class
End Namespace