Back to Devexpress

TdxPDFPageInfo.Images Property

vcl-dxpdfdocument-dot-tdxpdfpageinfo-7ebde8db.md

latest2.3 KB
Original Source

TdxPDFPageInfo.Images Property

Provides access to the collection of images on the PDF document page.

Declaration

delphi
property Images: TdxPDFImageList read;

Property Value

TypeDescription
TdxPDFImageList

The collection of images on the PDF document page.

|

Remarks

Use the Images field to access individual images on the page by their indexes.

Code Example: Saves the First Document Image to a File

You can use an image collection item’s Bitmap property to download a copy of an image on a PDF document page.

delphi
var
  ABitmap: TBitmap;
begin
  if not dxPDFViewer1.IsDocumentLoaded then Exit;
  // Obtains the first image on the first document page as a bitmap
  ABitmap := dxPDFViewer1.Document.PageInfo[0].Images[0].Bitmap;
  if ABitmap <> nil then
    ABitmap.SaveToFile('D:\Image0.bmp'); // Saves the obtained bitmap as the Image0.bmp file on the D drive
end;
cpp
TBitmap *ABitmap;
//...
  if(!dxPDFViewer1->IsDocumentLoaded()) { return; }
  // Obtains the first image on the first document page as a bitmap
  ABitmap = dxPDFViewer1->Document->PageInfo[0].Images->Items[0]->Bitmap;
  if(ABitmap != NULL)
    ABitmap->SaveToFile("D:\Image0.bmp"); // Saves the extracted bitmap as the Image0.bmp file on the D drive

Refer to the following topic for additional information: How to: Extract Content from PDF Documents.

Note

You cannot obtain images from a page if one of the following conditions is met:

  • Content extraction operations are forbidden for the loaded PDF document (the Images field value is nil (in Delphi) or nullptr (in C++Builder)).
  • The PDF document page has no images (the Images.Count property returns 0).

See Also

TdxPDFPageInfo Record

TdxPDFPageInfo Members

dxPDFDocument Unit