convert pdf to png

Carl K carl at personnelware.com
Tue Dec 25 13:02:07 EST 2007


Rob Wolfe wrote:
> Carl K <carl at personnelware.com> writes:
> 
>> I need to take the take the pdf output from reportlab and create a
>> preview image for a web page.  so png or something.  I am sure
>> ghostscript will be involved. I am guessing PIL or ImageMagic ?
>>
>> all sugestions welcome.
> 
> Did you try to use `reportPM` from rl_addons [1]_? 
> This is an extension of the reportlab package.
> 
> There is also PIL needed and on my linux box
> I needed some additional fonts [2]_.
> 
> And then I could create PNG directly from reportlab, e.g:
> 
> <code>
> from reportlab.graphics.shapes import Drawing, String
> from reportlab.graphics import renderPM
> 
> d = Drawing(400, 200)
> d.add(String(150, 100, 'Hello World', fontSize=18))
> renderPM.drawToFile(d, 'test.png', 'PNG')
> </code>
> 
> .. [1] http://www.reportlab.co.uk/svn/public/reportlab/trunk/rl_addons/
> .. [2] http://www.reportlab.com/ftp/fonts/pfbfer.zip

This sounds like what I was looking for.  some how this got missed when I poked 
around reportlab land.

Thanks much.

Carl K



More information about the Python-list mailing list