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

备注

示例

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