PdfDocumentProcessor.GetImages(PdfDocumentArea) Method
Retrieves the images found within the specified document area.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Docs.v23.2.dll
NuGet Package: DevExpress.Document.Processor
Declaration
Parameters
Name | Type | Description |
---|---|---|
area | PdfDocumentArea | A PdfDocumentArea object. |
Returns
Type | Description |
---|---|
IList<Bitmap> | A collection of Bitmap objects. |
Remarks
The overloaded GetImages
method uses the page coordinate system. See the following topic for more information: Coordinate Systems.
The GetImages
method requires that your application runs under Full Trust.
Warning
The GetImages
method uses GDI/GDI+ rendering and works only on Windows OS. The PlatformNotSupportedException
is thrown on other operating systems. Use the GetDXImages
method in non-Windows environments.
Example
This example illustrates the use of the PdfDocumentProcessor.GetImages method to obtain images from a PDF file.
using System;
using System.Collections.Generic;
using System.Drawing;
using DevExpress.Pdf;
// ...
static void Main(string[] args) {
PdfDocumentProcessor processor = new PdfDocumentProcessor();
processor.LoadDocument(@"..\\..\\Demo.pdf");
int xCount = 8;
int yCount = 2;
double cardWidth = 150.5; // Measured in points (equals 2.09 inches).
double cardHeight = 442; // Measured in points (equals 6.138 inches).
double xMargin = 122; // Measured in points (equals 1.694 inches).
double yMargin = 77; // Measured in points (equals 1.069 inches).
double yCoord = yMargin;
for (int y = 0; y < yCount; y++, yCoord += cardHeight) {
double xCoord = xMargin;
for (int x = 0; x < xCount; x++, xCoord += cardWidth) {
PdfDocumentArea area = new PdfDocumentArea(1,
new PdfRectangle(xCoord, yCoord, xCoord + cardWidth, yCoord + cardHeight));
IList<Bitmap> bitmaps = processor.GetImages(area);
if (bitmaps.Count != 0) {
bitmaps[0].Save(String.Format(@"{0}_{1}.bmp", x, y));
bitmaps[0].Dispose();
}
Console.WriteLine(bitmaps.Count.ToString());
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetImages(PdfDocumentArea) 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.