rlpycairo is a plugin backend renderer for the `reportlab.graphics.renderPM` module, designed to replace the legacy `_renderPM` C extension which experienced issues with complex documents. It extends the ReportLab PDF Toolkit, enabling the creation of rich PDF documents and charts in various bitmap and vector formats. Currently at version 0.4.0, the library is in a 'Pre-Alpha' development status, with periodic updates.
pip install rlpycairoVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure ReportLab to use `rlpycairo` as its rendering backend and then generate a simple PNG image using ReportLab's graphics module. This verifies the `rlpycairo` plugin is active and functional.
Ensure system-level Cairo development packages are installed (e.g., `sudo apt-get install libcairo2-dev` on Debian/Ubuntu, `brew install cairo` on macOS).
Be aware of potential performance or quality differences if your application heavily relies on scaled images or complex text rendering. Consider alternative backends or optimizations if these issues arise.
Do not expect advanced Cairo features like transparency or complex patterns to be automatically supported or exposed through `rlPyCairo` at this time. Use ReportLab's native features or other rendering backends for such requirements.
Verify `rlpycairo` is installed (`pip show rlpycairo`). Ensure `reportlab.rl_config.renderPMBackend = 'rlPyCairo'` is executed at an appropriate point in your application startup before any `reportlab.graphics.renderPM` calls.
Pin the exact version in your `requirements.txt` to mitigate unexpected changes (`rlpycairo==0.4.0`). Monitor project updates closely if upgrading to new pre-1.0.0 versions.