6

I want to add text or annotation in the exsting pdf file to interpret some key words.

At first I tried the pyPdf & reportlib to merge t he original pdf file & new generated interpretion pdf file, but it doesn't work. Because the original file keep out all the words of interpretation pdf and make new pdf file invisible. Don't know why? If I test to merge two new generated interpretion pdf file into one, it works well.

So I am thinking to try to use another way to insert just annotation into existing pdf file by python. Anybody have related experience can give me suggestion? Thanks!

1

1 Answer 1

2

Adding a watermark to existing pdf using PyPDF certainly works for me:

template = PdfFileReader(file("template.pdf", "rb")) #template pdf
output=PdfFileWriter() #writer for the merged pdf
for i in range(new.getNumPages()):
    page=template.getPage(i)
    page.mergePage(new.getPage(i))
    output.addPage(page)

Read my other SO answer for reference.

Read my complete article to know more about pdf generation and merging in python.

Sign up to request clarification or add additional context in comments.

1 Comment

the OP ask for inserting annotation and you answer with watermark...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.