Place image over PDF

pdf, python

Solution

https://pypi.org/project/pypdf/:

from pypdf import PdfWriter, PdfReader

writer = PdfWriter()
reader = PdfReader("document1.pdf")
watermark = PdfReader("watermark.pdf")

page = reader.pages[0]
page.merge_page(watermark.pages[0])
writer.add_page(page)

# finally, write the results to disk
with open("document-output.pdf", "wb") as fp:
    writer.write(fp)

I think it's like `watermark`, see the documentation for more information

Problem

How can I place an image over an existing PDF file at an specific coordinate location. The pdf represents a drawing sheet with one page. The image will be scaled. I'm checking ReportLab but can't find the answer. Thanks.

Original source