-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
nf-documentationNon-functional change: DocumentationNon-functional change: Documentationworkflow-annotationEverything about annotating PDF filesEverything about annotating PDF files
Description
I'm trying to add a polyline annotation to a pdf file.
It does not work whether it is an existing file or a new file (add_blank_page).
Environment
Which environment were you using when you encountered the problem?
$ python -m platform
macOS-12.6.1-arm64-arm-64bit
$ python -c "import pypdf;print(pypdf.__version__)"
3.8.0Code + PDF
This is a minimal, complete example that shows the issue:
from pypdf import PdfWriter
from pypdf.generic import AnnotationBuilder
writer = PdfWriter()
writer.add_blank_page(200, 200)
annotation = AnnotationBuilder.polyline(
vertices=[
(50, 50),
(50, 150),
(150, 150),
(150, 50),
(50, 50),
],
)
writer.add_annotation(page_number=0, annotation=annotation)
with open("output.pdf", "wb") as f:
writer.write(f)The output pdf file is empty: output.pdf
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
nf-documentationNon-functional change: DocumentationNon-functional change: Documentationworkflow-annotationEverything about annotating PDF filesEverything about annotating PDF files