I'm trying to use this Python library called pdf-annotate to add text annotation to existing PDF files. Here's the documentation of the library: https://github.com/plangrid/pdf-annotate
I got this sample code that add a square on the bottom left corner of the pdf file but couldn't figure out how to add free text instead of square. For example, I want to add a comment like "This document has been reviewed." instead of the square. This should be annotation on the existing pdf page instead of adding a new page to the pdf.
from pdf_annotate import PdfAnnotator, Appearance, Location
annotator = PdfAnnotator('sample.pdf')
annotator.add_annotation(
'square',
Location(x1=50, y1=50, x2=100, y2=100, page=0),
Appearance(fill=(1, 0, 0))
)
annotator.write('annotated.pdf')
I've been trying to review the source code in the documentation to figure out how to add text instead of square but couldn't figure it out. Does anyone know how to use this library to add text?