• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

742
Vistas
Python: Create automated strictly-designed multi-page .pdf report from .html

What are good Python-based options to create strictly designed .pdf reports from .html?

I've attached a draft .pdf to illustrate the following points:

  • The design of the report is rather strictly designed. In other words "Looks matter".
  • The report contains complex vector graphics (package: Matplotlib).These may slightly differ in size .
  • The report contains images.
  • The report contains a large number of numbers / strings filled in dynamically.
  • Optimally, the solution would use open source packages.
  • We create our .html with Django.
  • The report may span multiple pages.

It looks as if there was already a good amount of very diverse packages facilitating reporting. Just to name a few, there are xhtml2pdf, weasyprint, django-wkhtmltopdf.

In my experience, it’s easy with these tools to create a .pdf from your content. The hard part comes when the .pdf needs to fall into a highly-defined design structure as in our case. Unfortunately, I was not able to find example .pdfs for the different pdf generation packages that have a highly designed structure.

What is your experience with this? Which options worked well for you? Are there well done complex examples that I’ve overlooked?

Some example of a strictly-designed "Looks matter" report

over 3 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can see this Python package: weasyprint

Web page: http://weasyprint.org/

Official doc: http://weasyprint.readthedocs.io/en/latest/

It's great, because you can generate the PDF from a web page or an html file, you can have conflicts with some CSS (which are specified in the documentation), but it provides what you need

over 3 years ago · Santiago Trujillo Denunciar

0

I recently used weasyprint and jinja to do automated report generation from html. It worked well and I believe would be capable of meeting your strict format requirements. I haven't used any of the others though.

My report had images, including graphs converted to images, normal dynamically generated text, as well as large tables. All of this was constrained to an 9x11 page size. Weasyprint does a good job of pagination automatically, but also has configurability in that regard.

I found this guide to be very useful: http://pbpython.com/pdf-reports.html

Although I think pandas is total overkill for html generation of graphs and you lose a lot of configurability using it.

over 3 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda