Can anyone recommend a decent FOSS PDF generator for Python?

I need a basic pdf generator that'll let me toss some images and text into a pdf file. The ability to have some basic drawing commands (lines and so forth) would also be a plus.

I did read through this question, but I really don't need a report generator and most of the responses there seemed like real overkill for what I'm trying to do. (I don't need templates or LaTeX-grade layout control.)


Asked by: Kelvin888 | Posted: 01-10-2021






Answer 1

For one of my projects, I have tested and/or implemented probably six or seven different methods of going from an image to a PDF in the last six months. Ultimately I ended up coming back to ReportLab (which I had initially avoided for reasons similar to those you described) because all of the others had glaring limitations or outright omissions (such as the inability to set document metadata).

ReportLab isn't as difficult to handle as it appears at first glance and it may save you a lot of headache-laden refactoring later on. I would strongly suggest you go ahead and use it and therefore know that if you ever want to be able to do more you will have the ability too rather than do what I did and bounce back and forth between a number of different utilities, libraries, and formats.

EDIT:

It is also worth mentioning that you can bypass the Platypus layout system that comes with ReportLab if all you want to do is put bit a of text and imagery on a page.

Answered by: David991 | Posted: 02-11-2021



Answer 2

I think going through Latex is the easiest way, and not overkill at all. Generating a working PDF file is quite a difficult activity, whereas generating a Tex source is much easier. Any other typesetting change would probably work as well, such as going through reStructuredText or troff.

Answered by: Freddie877 | Posted: 02-11-2021



Answer 3

Is the reportlab code not ok? The reason why using LaTeX might not be overkill is because pdf is a really low-level format. In pdf you do not get line-breaks automatically, you have to calculate line-widths yourself.

Answered by: Victoria555 | Posted: 02-11-2021



Similar questions

java - XML instance generation from XML schema (xsd)


python - Dynamic generation of .doc files

How can you dynamically generate a .doc file using AJAX? Python? Adobe AIR? I'm thinking of a situation where an online program/desktop app takes in user feedback in article form (a la wiki) in Icelandic character encoding and then upon pressing a button releases a .doc file containing the user input for the webpage. Any solutions/suggestions would be much appreciated. PS- I don't want to go the C#/Java way with th...


python - django auto entry generation

I am trying to make an automated database entry generation with Django, whenever I trigger it to happen. For instance, assume I have a such model: class status_entry(models.Model): name = models.TextField() date = models.DateField() status = models.BooleanField() and I have several entries to the model such as: 1 - "bla bla" - 2009/11/6 - true 2 - "bla b...


code generation - Are there any libraries for generating Python source?

I'd like to write a code generation tool that will allow me to create sourcefiles for dynamically generated classes. I can create the class and use it in code, but it would be nice to have a sourcefile both for documentation and to allow something to import. Does such a thing exist? I've seen sourcecodegen, but I'd rather avo...


code generation - Python generating Python

I have a group of objects which I am creating a class for that I want to store each object as its own text file. I would really like to store it as a Python class definition which subclasses the main class I am creating. So, I did some poking around and found a Python Code Generator on effbot.org. I did some experimenting with it and here's what I came up with: # # a Python code generator backend # # fredri...


pdf generation - Jinja-like for Pdf in Python

I am looking for the best accurate tool for PDF in Python that works like Jinja does for HTML. What are your suggestions?


pdf generation - how to make fillable forms with reportlab in python


python - Dynamic form field generation in Django templates

I am having a problem figuring out how to solve this problem the Django and (probably) the Python way. I am sending a hash to a template that contains the following values {'date': '2009-12-30', 'locations': [{u'lat': 43.514000000000003, u'lng': -79.844032999999996, u'place': u'1053 Bowring Cres, Milton, ON L9T, CA', u'description': u'Home base'}, {u'lat': 43.730550000000001, u'lng': -79.805334000000002, u...


python - Haystack / Whoosh Index Generation Error

I'm trying to setup haystack with whoosh backend. When i try to gen the index [or any index command for that matter] i receive: TypeError: Item in ``from list'' not a string if i completely remove my search_indexes.py i get the same error [so i'm guessing it can't find that file at all] what might cause this error? it's set to autodiscover and i'm sure my app is installed because i...


python - Random string generation with upper case letters and digits

How do I generate a string of size N, made of numbers and uppercase English letters such as: 6U1S75 4Z4UKK U911K4






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top