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 |
ObjectType[Index] = otImage(或檢查 Assigned(Bmp)),並在 try .. finally 區塊中釋放RemoveObject 或 InsertObjectAtIndex)會改變頁面物件索引;編輯後請重新查詢 ObjectCount
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;