How to: Export a PDF Document to a Bitmap
- 2 minutes to read
Important
You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use these examples in production code. Refer to the DevExpress Subscription page for pricing information.
The following example demonstrates how to export pages to bitmap images.
Follow the steps below to perform the export:
- Create a PdfDocumentProcessor instance and load the PDF document using the overloaded PdfDocumentProcessor.LoadDocument method.
- Call the PdfDocumentProcessor.CreateBitmap method using the page number and thelargestEdgeLength parameter (measured in pixels). This parameter determines the output image’s height for pages in the portrait orientation and width for landscape pages.
- Save the converted bitmap images to a file using the overloaded Bitmap.Save method.
Note
Show Me 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");
}
}
}
}
}