Skip to content Skip to sidebar Skip to footer

Pypdf2: Why Does Pdffilewriter Forget Changes I Made To A Document?

I am trying to modify text in a PDF file. The text can be in an object of type Tj or BDC. I find the correct objects and if I read them directly after changing them they show the u

Solution 1:

The solution is to assign the ContentStream that is being iterated and changed to the page afterwards before passing it to the PdfFileWriter:

page[NameObject('/Contents')] = content
output.addPage(page)

I found the solution reading this and this.

Post a Comment for "Pypdf2: Why Does Pdffilewriter Forget Changes I Made To A Document?"