[reportlab-users] prevent paragraph splitting up

Andy Robinson andy at reportlab.com
Tue Jul 11 17:51:14 EDT 2006

Mike Hodkin wrote:
> Oh, I see.  While I have your attention,  two questions if I may:
> Your product is excellent, but is there a way (1) to implement a preview 
> of a ReportLab PDF printout (specifically, a ReportLab Drawing) within a 
> Tkinter widget?  I created a Python app which produces a graphic (using 
> Tkinter's canvas widget) based on user input.  Naturally, ReportLab's 
> PDF is a great way to print out the graphic but it would be great to see 
> a quick preview in the GUI frame instead of actually sending it to a PDF 
> and have that open in another window.   

You cannot render a whole page to bitmap, but for anything based on a 
Drawing you can save to bitmaps easily using the various functions in
reportlab.graphics.renderPM named 'drawTo...'.  Probably the quick and 
easy way is to create a GIF/PNG in a temporary file and then load it 
into the canvas, but I'm sure there's a way to do it in memory too.

 > Also, is there a way to (2) use
> a Tkinter's Canvas object as an input to one of ReportLab's methods in 
> order to printout the result?
No.  I think the Tkinter Canvas has a small subset of our capabilities 
so it's possible in principle to wrap it but I don't know of anyone who
as done.

- Andy

More information about the reportlab-users mailing list