Skip to contents

Wraps FPDFPage_CreateAnnot + (optionally) FPDFAnnot_SetRect. PDFium supports creating annotations of subtype "circle", "fileattachment", "freetext", "highlight", "ink", "link", "popup", "square", "squiggly", "stamp", "strikeout", "text", and "underline". Other subtypes ("widget", "polygon", "line", etc.) error from PDFium.

Usage

pdf_annot_new(page, subtype, bounds = NULL)

Arguments

page

A pdfium_page from pdf_page_load(). Parent doc must be readwrite.

subtype

Character scalar — one of the supported annotation subtypes listed above.

bounds

Optional length-4 numeric vector c(left, bottom, right, top) in PDF user-space points. Default NULL (annotation has no rect set — most subtypes still need one and you'll likely follow up with pdf_annot_set_bounds()).

Value

The new pdfium_annot handle.

Details

The new annotation is appended to the page's /Annots array. Use pdf_annotations() to re-read the page if you need an updated handle list — the new annotation lands at the end.