THotPDF.NewLoadedAnnotation Method
Creates a new annotation dictionary of the specified subtype on the specified page of the loaded PDF document, suitable for appending various annotations such as highlights, links, and text annotations to an existing PDF
Declaration
function NewLoadedAnnotation(PageIndex: Integer; const ASubtype: AnsiString; ARect: THPDFRect): THPDFDictionaryObject;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
PageIndex | Zero-based index of the target page, specifying the page where the annotation is located |
ASubtype | 注释子类型名称,如 Text、Link、Highlight,对应 PDF 规范中的 Subtype 键值 |
ARect | The position and size rectangle of the annotation on the page, using the PDF coordinate system (origin at the bottom-left corner of the page) |
Return value
返回代表新建注释的 THPDFDictionaryObject,可进一步写入颜色、内容文本、动作等附加属性
Usage notes
ASubtype必须符合 PDF 规范中定义的有效注释子类型字符串,无效子类型可能导致阅读器忽略该注释- Newly created annotations are automatically registered to the target page's Annots array; there is no need to manually append them to the page dictionary
- If the returned dictionary object is modified before saving the document, the document's internal modification mechanism must be used; the reference must not be held after the document is closed