PdfDocumentProcessor.GetDXImages(PdfDocumentArea) Method
In This Article
Retrieves the images found in the specified document area. Use this method in non-Windows environments.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Docs.v24.2.dll
NuGet Package: DevExpress.Document.Processor
#Declaration
public IList<DXBitmap> GetDXImages(
PdfDocumentArea area
)
#Parameters
Name | Type | Description |
---|---|---|
area | Pdf |
A page area from which the images should be retrieved. |
#Returns
Type | Description |
---|---|
IList<DXBitmap> | A collection of DXBitmap objects. |
#Remarks
The overloaded GetDXImages
method uses the page coordinate system. See the following topic for more information: Coordinate Systems.
#Example
The following code retrieves images from the specified page area:
using System;
using System.Collections.Generic;
using DevExpress.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<DXBitmap> bitmaps = processor.GetDXImages(area);
if (bitmaps.Count != 0) {
bitmaps[0].Save(String.Format(@"{0}_{1}.bmp", x, y), DXImageFormat.Bmp);
bitmaps[0].Dispose();
}
Console.WriteLine(bitmaps.Count.ToString());
}
}
}
See Also