PDFium Delphi Component Docs

ObjectBitmap 屬性

元件: TPdf  ·  單元: PDFium
索引屬性 — 將單一影像頁面物件傳回為可繪製的 VCL TBitmap(會從 JPX/CCITT 等格式進行有損解碼)

語法

property ObjectBitmap[Index: Integer]: TBitmap; // read only

說明

索引式唯讀屬性,當 ObjectType[Index] = otImage 時,把 Index 處的頁面物件傳回為新配置的 VCL/LCL TBitmap;非影像頁面物件則傳回 nil

要求 Active 為 True。有效索引為 0 .. ObjectCount - 1(若想只用影像計數在 0 .. BitmapCount - 1 內索引,請改用 Bitmap[Index])

呼叫端擁有傳回的 TBitmap 實例,用畢必須呼叫 Free

參數

Index以 0 為基底的頁面物件索引,範圍 0 .. ObjectCount - 1

備註

範例

var
  I: Integer;
  Bmp: TBitmap;
begin
  if not Pdf1.Active then Exit;
  for I := 0 to Pdf1.ObjectCount - 1 do
    if Pdf1.ObjectType[I] = otImage then
    begin
      Bmp := Pdf1.ObjectBitmap[I];
      try
        if Assigned(Bmp) then
          Memo1.Lines.Add(Format('Object %d: %dx%d', [I, Bmp.Width, Bmp.Height]));
      finally
        Bmp.Free;
      end;
    end;
end;

另請參閱

BitmapCount, Image, ImageCount