property Bitmap[Index: Integer]: TBitmap; // read only
| Index | 目前頁面上以 0 為基底的影像索引,範圍 0 到 BitmapCount - 1 |
Bitmap 傳回包含目前頁面第 n 個點陣影像像素資料的 TBitmap。PDFium 會解碼底層串流(JPEG、JPEG2000、CCITT、JBIG2 或 FlateDecode 像素資料),PDFium Delphi Component 再將結果轉換為以影像儲存解析度呈現的 VCL TBitmap;當來源提供軟式遮罩時,alpha 會以 32 位元 ARGB 表面保留
每次呼叫都會配置新的點陣圖;此屬性不做快取。這讓此屬性可安全地從工作執行緒呼叫,但也表示呼叫端必須一律釋放傳回的物件,通常是在 try .. finally 區塊內
若還需要影像在頁面上的變換矩陣與週框矩形,請改用 Image[Index] — 它會傳回將相同 TBitmap 與位置中繼資料打包在一起的記錄。與形狀無關的兄弟成員 ObjectBitmap[ObjectIndex] 則索引完整的頁面物件陣列(混合文字、路徑、影像),若目標物件恰好是影像,會傳回相同的點陣圖
nil
// Export every image on the current page as numbered BMP files
var
I: Integer;
Bmp: TBitmap;
begin
for I := 0 to Pdf.BitmapCount - 1 do
begin
Bmp := Pdf.Bitmap[I];
try
Bmp.SaveToFile(Format('page_%d_img_%d.bmp', [Pdf.PageNumber, I]));
finally
Bmp.Free;
end;
end;
end;