AnnotationCollection
概述
AnnotationCollection 是 Aspose.PDF FOSS 中用于 .NET 的类。继承自:IReadOnlyList<Annotation>。
页面上的注释集合。
此类提供 35 个方法,用于在 .NET 程序中处理 AnnotationCollection 对象。可用的方法包括:Accept、Add、AddCaretAnnotation、AddCircleAnnotation、AddFileAttachmentAnnotation、AddFreeTextAnnotation、AddHighlightAnnotation、AddInkAnnotation、AddLineAnnotation、AddLinkAnnotation、AddPolyLineAnnotation、AddPolygonAnnotation,以及另外 17 个方法。所有公共成员在安装了 Aspose.PDF FOSS for .NET 包之后,任何 .NET 应用程序均可访问。属性:Count、IsReadOnly、IsSynchronized、SyncRoot。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
Count | int | 读取 | 获取计数。 |
IsReadOnly | bool | 读取 | 始终为假:调用者可能会添加和删除注解。 |
IsSynchronized | bool | 读取 | 始终为假:调用者对自己的访问进行序列化。 |
SyncRoot | object | 读取 | 用于 ICollection.SyncRoot 样式锁定的哨兵对象。 |
方法
| 签名 | 描述 |
|---|---|
AddTextAnnotation(rect: Rectangle, contents: string, title: string?, open: bool) | 添加文本(便签)注释。 |
AddFreeTextAnnotation(rect: Rectangle, contents: string, fontName: string?, fontSize: double, color: double[]?) | 添加自由文本注释(直接显示在页面上的文本)。 |
AddLinkAnnotation(rect: Rectangle, uri: string) | 添加带有 URI 动作的链接注释。 |
AddLinkAnnotation(rect: Rectangle, destinationPage: int, destRect: Rectangle) | 添加带有页面目标的链接注释(用于目录条目)。 |
AddLinkAnnotation(rect: Rectangle, action: PdfAction) | 添加带有自定义动作的链接注释。 |
AddHighlightAnnotation(rect: Rectangle, quadPoints: double[]?, color: double[]?) | 添加高亮注释。 |
AddUnderlineAnnotation(rect: Rectangle, quadPoints: double[]?, color: double[]?) | 这是带下划线的注释示例。. |
AddStrikeOutAnnotation(rect: Rectangle, quadPoints: double[]?, color: double[]?) | 添加删除线注释。 |
AddSquareAnnotation(rect: Rectangle, borderColor: double[]?, fillColor: double[]?, lineWidth: double) | 添加方形(矩形)注释。 |
AddCircleAnnotation(rect: Rectangle, borderColor: double[]?, fillColor: double[]?, lineWidth: double) | 添加圆形(椭圆)注释。 |
AddLineAnnotation(rect: Rectangle, x1: double, y1: double, x2: double, y2: double, color: double[]?, lineWidth: double) | 添加线条注释。 |
AddInkAnnotation(rect: Rectangle, inkPaths: double[][], color: double[]?, lineWidth: double) | 添加墨迹(手绘)批注。 |
AddStampAnnotation(rect: Rectangle, contents: string, stampName: string) | 添加橡皮图章批注。 |
AddCaretAnnotation(rect: Rectangle, contents: string?) | 添加插入符号批注(插入点)。 |
AddRedactAnnotation(rect: Rectangle, color: double[]?, overlayText: string?) | 添加编辑遮蔽批注。 |
AddFileAttachmentAnnotation(rect: Rectangle, contents: string, fileName: string, fileData: byte[]) | 添加文件附件批注。 |
AddSquigglyAnnotation(rect: Rectangle, quadPoints: double[]?, color: double[]?) | 添加波浪线下划线批注。 |
AddPolygonAnnotation(rect: Rectangle, vertices: double[], borderColor: double[]?, fillColor: double[]?, lineWidth: double) | 添加多边形批注。 |
AddPolyLineAnnotation(rect: Rectangle, vertices: double[], color: double[]?, lineWidth: double) | 添加折线批注。 |
AddPopupAnnotation(rect: Rectangle, open: bool) | 添加一个弹出注释。 |
AddWatermarkAnnotation(rect: Rectangle, contents: string?) | 添加水印注释。 |
Add(wa: WatermarkAnnotation) | 添加一个 WatermarkAnnotation 对象。 |
Add(annotation: Annotation) | 添加任何通过编程方式创建的注释。 |
Add(annotation: Annotation, considerRotation: bool) | 添加注释。 |
Clear() | 从集合中移除所有注释。 |
Contains(annotation: Annotation) | 当注释当前在集合中时为 True(先按引用匹配,然后按 backing dict 匹配)。 |
CopyTo(array: Annotation[], index: int) | 将注释复制到数组中,从指定索引开始。 |
Delete() | 从集合中移除所有注释(public-API 是 Clear 的别名;为保持 API 的一致性而保留)。 |
Delete(index: int) | 移除给定的基于 1 的索引处的注释。 |
FindByName(name: string) | 查找 /NM(注释名称)条目与 name 匹配的注释。 |
Remove(annotation: Annotation) | 移除第一个匹配的注释;当成功移除注释时返回 true。 |
Delete(annotation: Annotation) | 从集合中删除给定的注释。 |
RemoveAt(index: int) | 在给定的索引处移除注释。 |
GetEnumerator() | 在底层列表的快照上遍历注释,以便调用者能够在 foreach 循环内部(通过 Delete / RemoveAt)移除注释,而不会触发实时集合保护。 |
Accept(visitor: AnnotationSelector) | 遍历集合中的每个注释并将其分派给访问者。 |