1

I'm trying to make a PDF file in Python, but all of the tools I find only work on Python 2.7 (or lower) and I'm using 3.2. I there a tool or something that works on 3.2 and generates PDF files? Or a way to make 2.7 (or lower) code work on 3.2?

1 Answer 1

1

Not personally tested with Python 3.x, but official page says weasyprint works with it. It allows for HTML to PDF conversion, so depending on your needs and the rest of the project this may be an advantage or disadvantage.

For a low-level "draw the PDF yourself" you might want to try cairo, but looks like the automatic installation is a bit incomplete: Cairo example works with Python 2.7 but does not work in Python 3

To convert python 2.x code to python 3.x code you may use the following two tools:

  1. 2to3
  2. Your brain

The latter tool are much more powerful, and sort of guarantees successful conversion, but a little bit slow compared to the former.

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

Comments

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.