PDFium Delphi Component Docs

PageObjectsSnapshot 属性

组件: TPdf  ·  单元: PDFium
以托管记录形式返回某一页上所有对象的缓存有界快照

语法

property PageObjectsSnapshot[PageNumber: Integer]: TPdfPageObjectsSnapshot; // read only

 

type TPdfPageObjectsSnapshot = record
  PageNumber: Integer;
  Width: Double;
  Height: Double;
  Status: TPdfPageObjectSnapshotStatus;
  Objects: TPdfPageObjectSnapshots;
end;

PageNumberInteger。已加载文档中从 1 开始的页索引
StatusTPdfPageObjectSnapshotStatus。完成标志、已访问对象计数以及已触发的预算标志
Objects每个对象的记录,包含类型、边界、变换、颜色、虚线数组、路径与剪裁线段、内容标记、图像元数据和有界文本

说明

页面首次被访问时按 TPdfPageObjectSnapshotOptions.Default 预算捕获快照。活动页面通过其已加载的句柄读取,其他页面则临时加载并关闭,不更改 PageNumber 也不触发 OnPageChange

每次访问都返回深拷贝,因此修改嵌套的虚线数组、标记参数、路径线段、剪裁路径、滤镜或字符串都无法更改缓存数据或文档

完成的快照保留在由 PageObjectSnapshotCacheCapacity 描述的有界缓存中,并对照 CacheBudgetBytes 计量;PageComplexity 在对象类型、路径计数、图像像素和透明度方面复用此缓存

备注

在没有活动文档时调用会抛出 EPdfError;PageNumber 超出 1 到 PageCount 范围时抛出 EPdfError,消息为 Incorrect page number

需要自定义捕获预算或有意绕过缓存时,请使用 ReadPageObjectsSnapshot

示例

Snapshot := Pdf.PageObjectsSnapshot[PageNumber];
for I := 0 to High(Snapshot.Objects) do
  if Snapshot.Objects[I].ObjectType = otImage then
    LogImageObject(I);

参见

PageObjectSnapshotCacheCapacity, PageObjectSnapshotCacheCount, PageObjectSnapshots, PageObjectInfo, PageComplexity