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 .. ObjectCount - 1 范围内从 0 开始的页面对象索引 |
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;