addSigFieldLM: Add Acrobat-Reader signature fields to a report PDF

View source: R/addSigFieldLM.R

addSigFieldLMR Documentation

Add Acrobat-Reader signature fields to a report PDF

Description

Insert empty digital-signature form fields (AcroForm /Sig fields) into a PDF so it can be signed in Adobe Acrobat Reader (the free reader) with one click: open the PDF, click a field, and sign with a Digital ID. The field is added with a pure base-R PDF incremental update, with no external tools or packages, so it works wherever R does. It is designed for the simple PDFs produced by IQLM and OQLM.

Acrobat Reader can also sign a PDF that has no field at all (“All tools” > “Use a certificate” > “Digitally sign”, then drag a rectangle). This function only makes the workflow click-to-sign by pre-placing labelled fields.

Usage

addSigFieldLM(pdf, out = pdf, page = 1L,
           fieldNames = c("Performed_by", "Reviewed_by"), rects = NULL)

Arguments

pdf

path to the input PDF.

out

path to write the result; defaults to overwriting pdf.

page

1-based page number to place the field(s) on (the signature page is page 1 of IQLM/OQLM reports).

fieldNames

character vector of field names; one signature field is added per name. The names appear in Acrobat's Signature panel.

rects

optional list of numeric length-4 rectangles c(x0,y0,x1,y1) in PDF points (origin at the lower-left of the page), one per field. If NULL, sensible stacked rectangles are used within the page margins.

Details

The function appends an incremental-update section that adds an /AcroForm to the document catalog (with /SigFlags 3), one /Widget signature annotation per field, and the field references to the page's /Annots. The original content is left untouched. The resulting fields are unsigned; the actual cryptographic signature is applied by Acrobat Reader using the signer's Digital ID. Only classic cross-reference-table PDFs are supported (those written by R's pdf device); the function stops on cross-reference-stream PDFs.

Value

Invisibly, the output path. A PDF with signature fields is written as a side effect.

Author(s)

Kyun-Seop Bae <k@acr.kr>

See Also

IQLM, OQLM, signPDFLM

Examples

#IQLM("sasLM-IQ-Report.pdf", performedBy = "Kyun-Seop Bae")
#addSigFieldLM("sasLM-IQ-Report.pdf")          # adds Performed_by / Reviewed_by fields
## or in one step:
#IQLM("sasLM-IQ-Report.pdf", performedBy = "Kyun-Seop Bae", sigField = TRUE)
## then open in Acrobat Reader and click each field to sign with your Digital ID.

sasLM documentation built on July 14, 2026, 5:06 p.m.