Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 324 Bytes

adding-pdf-annotations.md

File metadata and controls

16 lines (11 loc) · 324 Bytes

Adding PDF Annotations

Attachments

from PyPDF2 import PdfWriter

writer = PdfWriter()
writer.add_blank_page(width=200, height=200)

data = b"any bytes - typically read from a file"
writer.add_attachment("smile.png", data)

with open("output.pdf", "wb") as output_stream:
    writer.write(output_stream)