PDFium Delphi Component Docs

ObjectCount 属性

组件: TPdf  ·  单元: PDFium
当前页面上的页面对象(文本、路径、图像、渐变、表单)只读数量

语法

property ObjectCount: Integer; // read only

说明

返回与打开 PDF 文档关联的页面对象(文本、路径、图像、渐变、表单)数量。当 PageNumber 被赋值为不同的页面,或在插入或移除页面对象的变更调用之后,计数会改变

该值直接从底层 PDFium 引擎读取(要求 Active 为 True 且已加载当前页面)。当文档已关闭、在查询范围内没有页面对象(文本、路径、图像、渐变、表单)或该属性不适用于当前 PDF 时,结果为 0

该值通过 FPDFPage_CountObjects 从活动页面查询

备注

示例

var
  I: Integer;
begin
  if not Pdf1.Active then Exit;
  Memo1.Lines.Add(Format('%d page objects (text, path, image, shading, form)', [Pdf1.ObjectCount]));
  for I := 0 to Pdf1.ObjectCount - 1 do
  begin
    // 检查每个条目
    Memo1.Lines.Add(Format(' [%d]', [I]));
  end;
end;

参见

ObjectHandle, ObjectBounds, ObjectTransparent