File: pdf-annotate.py

package info (click to toggle)
endesive 2.19.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,128 kB
  • sloc: python: 18,368; xml: 800; sh: 195; javascript: 118; makefile: 23
file content (18 lines) | stat: -rwxr-xr-x 397 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env vpython3
from pdf_annotate import PdfAnnotator, Location, Appearance

annotationtext = "some text"

a = PdfAnnotator("pdf.pdf")
a.add_annotation(
    "text",
    Location(x1=50, y1=50, x2=200, y2=100, page=0),
    Appearance(
        fill=(0, 0, 0),
        stroke_width=1,
        wrap_text=True,
        font_size=12,
        content=annotationtext,
    ),
)
a.write("pdf-a.pdf")