[reportlab-users] PDF Transparency
robin at reportlab.com
Thu Nov 27 12:45:31 EST 2008
King Simon-NFHD78 wrote:
> Does anyone have any plans to support the PDF Transparency model in
> The basic idea was:
> * add an attribute to the canvas that tracks ExtGStates
> * add set[Non]StrokeAlphaConstant methods that create and activate new
> * in canvas.showPage, pass the ExtGStates on to the page
> * add strokeOpacity and fillOpacity to some of the shapes in
> * update _PDFRenderer.applyStateChanges to pas those properties on to
> the canvas.
> I also had to update PDFHeader to PDF version 1.4, because that is the
> first version that supported transparency.
> This is the first time I've looked at both the PDF spec and the
> reportlab code, so I've probably done something very silly. Does this
> approach sound reasonable?
> One flaw at the moment is that a new graphics state gets created every
> time you call set[Non]StrokeAlphaConstant, even if you pass the same
> parameter. It would be much better to reuse states if possible.
> I can post the patch if anyone is interested.
> Thanks for listening,
> Simon King
by all means post the patch. I guess the main problem is that we'd probably like
to expose 1.4 capabilities in a controlled way. Perhaps we should have an
attribute that specified which level of PDF is being aimed at. I guess that
should probably be on the PDFDoc, but perhaps it should be settable on the
canvas (as that needs support as well).
More information about the reportlab-users