[reportlab-users] Changing fonts for a SimpleDocTemplate

Thejaswi Puthraya thejaswi.puthraya at gmail.com
Wed Nov 24 00:58:27 EST 2010


Hi,

On Mon, Nov 22, 2010 at 4:10 PM, Robin Becker <robin at reportlab.com> wrote:


> On 20/11/2010 06:43, Thejaswi Puthraya wrote:

> ...........

>

> So I was thinking of embedding a custom font. Here's how I am trying it

>> and

>> it doesn't seem to work (I am fairly sure I am missing something)

>>

>

[snipped]



> .......

>

>

> OK I was being stupid. You've saved the document in the doct.build command.

> then you save it again in the canvas save command. Just remove the lines

>

>

> > canvas = doct.canv

> > canvas.setTitle("Some title")

> > canvas.showPage()

> > canvas.save()

>

> in the above and it starts to work.

>


Thanks! That worked. I had to make a few changes because I had to manipulate
the canvas after the build and send it in an HTTP response.

Here was my workaround (feels hackish but couldn't think of any way better):

doct._doSave = 0
doct.build(page_flowables)
canvas = doct.canvas
canavs.setTitle("Some Title")
canvas.showPage()
# send the raw canvas data in a HTTP response
canvas.getpdfdata()

--
Cheers
Thejaswi Puthraya
http://thejaswi.info/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20101124/47084909/attachment.html>


More information about the reportlab-users mailing list