What's New In Reportlab 4.0
released on 4th May 2023
We're very excited to release Reportlab 4.0, the first major release in several years. The main changes are to
- increase portability by removing C dependencies or making them optional
- add support for creating accessible PDF documents in the commercial version
As far as we know this will be fully backwards compatible, unless using some of the deprecated libraries below at a low level.
We now build for python >=3.7, <=3.11
If you have any feedback on this then please let us know.
ReportLab PLUS & Accessibility
ReportLab PLUS now lets you generate accessible PDF documents. Many government departments and regulators are now requiring this. For a broader background and a tutorial, read our accessibility page.
Removal of C code
We've had some C extensions for many years, and maintaining the builds took up a huge amount of time which could otherwise be spent on improving the core product. This release removes...
- the rl_accel C module which accelerates some functions is generally not necessary any more; Python is a lot faster than it was 20 years ago. You can still compile and use it if you wish
- the renderPM extension which lets you create bitmap versions of complex graphics now uses other python libraries which wrap up
freetype
, the font rendering engine, so that we don't need to worry about linking to it. Under the hood it usesPyCairo
as a renderer by default (rather than the no-longer-supportedlibart
), andfreetype-py
to render text glyphs - the default XML parser in ReportLab PLUS is now
lxml
, rather than the no-longer-supportedpyRXP
Settings
You can customize your distribution by editing reportlab/rl_settings.py
and, in most cases, get back to the previous behaviour with the settings below...
xmlParser='lxml'
This is unused in reportlab open source, but it controls the parser used by rlextra >= 3.6.12. To use the old pyRXP parser set to 'pyrxp'. The switch between parsers is controlled by module rlextra.radxml.xml2tt . By default we use 'lxml' even when set to 'pyrxp' if pyRXPU is not available. This is because pillow uses lxml as a dependency.
renderPMBackend='rlPyCairo'
This controls which backend is used for creating pixel map drawings
The new default is rlPyCairo
but you can switch back to the older _renderPM
which uses the existing _renderPM
module which is part of src/rl_addons and uses the
ancient libart_lgpl
graphics code. Main source is src/rl_addons/renderPM/_renderPM.c.
textPaths='freetype'
This setting controls how we obtain paths for text strings; the old case is
that we use the _renderPM
gstate _stringPath
method. If freetype-py is
installed we can use it to obtain paths and this is used when textPaths is
'freetype'. The alternatives are _renderPM
(use old mechanism) or 'backend'
when we try to use freetype with rlPyCairo and renderPM
when using that PM
backend. The switch takes place in function reportlab.graphics.utils.__makeTextPathsCode__