function ReadStructureElements(PageNumber: Integer; const Options: TPdfStructureReadOptions; out Status: TPdfStructureReadStatus): TPdfStructureElements;
使用迭代的先序遍历,返回由调用方持有的扁平化快照,其中带有稳定的 Level 和 ParentIndex 值
每个 TPdfStructureElement 还通过 MarkedContentIDs、ChildCount、ChildMarkedContentIDs 和 AttributeCount 报告层级事实,通过 HasHeaders、HeadersIds 和 ColSpan 报告表格结构,并通过 HasPrintField 和 HasReference 报告打印与引用哨兵
角色映射通过 RoleMappedNamespaceUri 和 RoleMappedTypeName 暴露,关联文件通过 HasAssociatedFile、AssociatedFileRelationship、AssociatedFileDescription、AssociatedFileDeclaredInCatalog、AssociatedFileDeclaredInStructure、AssociatedFileInEmbeddedFilesNameTree、AssociatedFileHasReadingOrder 和 AssociatedFileReadingOrderIndex 暴露,注释事实则通过 AnnotationSubtype、AnnotationContents、AnnotationAlternateText、IsArtifact、控件哨兵 WidgetCount 和 HasAppearance 以及 FieldAlternateName 暴露
MaxDepth、MaxElements、MaxAttributeValues 和 DeadlineMilliseconds 为原生工作和托管分配设定上限
IncludeAttributes=False 保留结构文本、层级和 MCID,同时跳过属性值的物化
当达到任何预算、截止期限到期或访问器停止遍历时,Status.Completed 为 false
Status.ElementsVisited 和 Status.AttributeValuesVisited 统计已完成的工作,而 Status.DepthLimitReached、Status.ElementLimitReached、Status.AttributeLimitReached 和 Status.DeadlineReached 标识是哪个预算终止了遍历
function VisitStructureElements(PageNumber: Integer; const Options: TPdfStructureReadOptions; Visitor: TPdfStructureElementVisitor; out Status: TPdfStructureReadStatus): Integer;
为每个元素调用一次 Visitor,而不分配完整的页面数组
将回调的 KeepGoing 参数设为 false 即可正常提前停止,并通过 Status.VisitorStopped 报告
每次回调接收的是可以在回调返回后继续保留的托管元素数据,且不会暴露任何原生结构句柄
property StructureElementsForPage[PageNumber: Integer]: TPdfStructureElements; // read only
读取任意从 1 开始的页面,而不改变 PageNumber 或触发 OnPageChange
按默认预算完成的结果会进入共享的 LRU 缓存,供 StructureElements、TPdfView.StructureElements、可读内容、重排、结构化文本和无障碍验证使用
嵌套的动态数组和属性 blob 会被深拷贝,因此修改返回的快照不会影响缓存或 PDF
property StructureCacheCapacity: Integer; // read and write, default 8
限制按最近最少使用顺序保留的完整页面快照数量
将容量设为零可释放缓存的快照并禁用后续缓存
负的容量值会引发 EPdfError
property StructureCacheCount: Integer; // read only
property StructureCacheHitCount: Int64; // read only
property StructureCacheMissCount: Int64; // read only
公开组件实例的累计查找遥测数据
编辑会使受影响的页面或整个缓存失效,同时保留累计计数器
| MaxDepth | 256 |
| MaxElements | 100000 |
| MaxAttributeValues | 100000 |
| DeadlineMilliseconds | 0 表示无截止期限 |
| IncludeAttributes | True |