Docs de PDFiumVCL

BitmapCount property

Esta entrada API conserva identificadores, firmas, bloques de código y términos PDF en su forma original.
Component: TPdf  ·  Unit: PDFium
Number of image page objects on the active page, accessible as VCL TBitmap.

Syntax

property BitmapCount: Integer; // read only

Description

BitmapCount returns the count of image page objects on the currently active page (PDF 1.7 spec section 8.9). It pairs with the indexer Bitmap[Index], which decodes the underlying image stream into a fully rendered Delphi TBitmap (32-bit RGBA, ready for Canvas.Draw, clipboard transfer, or saving to PNG/BMP).

The value is 0 when Active is False, when PageNumber is invalid, or when the page contains no image objects. The count is identical to ImageCount; the two properties differ only in the return type of their indexers — Image[Index] hands back the raw decoded pixel buffer in a TPdfImage record, whereas Bitmap[Index] wraps that buffer into a managed VCL TBitmap owned by the caller.

The typical loop is for I := 0 to Pdf.BitmapCount - 1 do followed by Pdf.Bitmap[I]. Each access allocates a new TBitmap and copies pixels — do not call it in tight rendering loops; cache the bitmap when reused. Free each returned bitmap when finished to release GDI resources promptly.

Remarks

Example

var I: Integer;
var Bmp: TBitmap;
for I := 0 to Pdf1.BitmapCount - 1 do
begin
  Bmp := Pdf1.Bitmap[I];
  try
    Bmp.SaveToFile(Format('image_%d.bmp', [I]));
  finally
    Bmp.Free;
  end;
end;

See Also

Bitmap, ImageCount, Image, ObjectBitmap