Skip to content
Advertisement

Writing text over a PDF in python3

I am trying to write some string to a PDF file at some position. I found a way to do this and implemented it like this:

JavaScript

It throws me an error at can.save() line

The error :

JavaScript

Have read up at a lot of places on the internet. Found the same method everywhere. Is it the wrong way to do. Am I missing something?

Advertisement

Answer

Figured out I just had to use BytesIO instead of StringsIO.

Also open() instead of file() because I’m using Python3.

Here is the working script:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement