property BitmapCount: Integer; // read only
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 a
TPdfImage record whose Data holds the decoded pixel buffer
and whose RawData carries the still-encoded image stream, 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
TBitmap alpha channel automatically by PDFiumImageCount / Image[Index] avoids the GDI bitmap
allocation overhead
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;