PDFium Component Docs

BitmapCount Propriété

Composant: TPdf  ·  Module: PDFium
Nombre d’objets image de page sur la page active, accessibles sous forme de VCL TBitmap

Syntax

property BitmapCount: Integer; // read only

Description

BitmapCount renvoie le nombre d’objets image de page sur la page actuellement active (section 8.9 de la spécification PDF 1.7). Il se combine avec l’indexeur 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 est invalide, ou lorsque la page ne contient aucun objet image. Le comptage est identique à ImageCount; les deux propriétés ne diffèrent que par le type de retour de leurs indexeurs — 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