2025-02-08 07:33:47 +01:00
|
|
|
|
Going Further
|
|
|
|
|
=============
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Why pydyf?
|
|
|
|
|
-------------
|
|
|
|
|
|
2025-02-08 07:40:28 +01:00
|
|
|
|
pydyf has been created to replace Cairo_ PDF generation in WeasyPrint_.
|
2025-02-08 07:33:47 +01:00
|
|
|
|
|
2025-02-08 07:40:28 +01:00
|
|
|
|
Indeed, there were some bugs in WeasyPrint caused by Cairo, and new versions of
|
|
|
|
|
Cairo can take a long time to be released. There are also many features that
|
|
|
|
|
are easier to implement with more control on the PDF generation.
|
2025-02-08 07:33:47 +01:00
|
|
|
|
|
|
|
|
|
So we created pydyf.
|
|
|
|
|
|
|
|
|
|
.. _WeasyPrint: https://www.courtbouillon.org/weasyprint
|
|
|
|
|
.. _Cairo: https://www.cairographics.org/
|
|
|
|
|
|
|
|
|
|
Why Python?
|
|
|
|
|
-----------
|
|
|
|
|
|
2025-02-08 07:40:28 +01:00
|
|
|
|
Python is a really good language to design a small, OS-agnostic library. As it
|
|
|
|
|
is object-oriented, it gives the possibility to follow the PDF specification
|
|
|
|
|
with high-level classes and a small amount of very simple code.
|
2025-02-08 07:33:47 +01:00
|
|
|
|
|
|
|
|
|
And of course, WeasyPrint is written in Python too, giving an obvious reason
|
|
|
|
|
for this choice.
|
|
|
|
|
|
2025-02-08 07:40:28 +01:00
|
|
|
|
Speed is not pydyf’s main goal. Code simplicity, maintainability and
|
|
|
|
|
flexibility are more important goals for this library, as they give the ability
|
|
|
|
|
to stay really close to the specification and to fix bugs easily.
|