[reportlab-users] embedding vector graphics in reportlab pdf

Robin Becker robin at reportlab.com
Tue Dec 4 05:09:58 EST 2007


Jason Craig wrote:

> Michael Hearne wrote:

>> I'm trying to recreate a PDF report currently being generated with a

>> Perl postscript library. The output looks very crisp, as all of the

>> components are generated either with postscript commands or with

>> encapsulated postscript images.

>>

>> So far as I can tell, Reportlab cannot import encapsulated Postscript

>> (as PIL cannot), and I'm having trouble making my PNG images in the

>> PDF look as crisp as their .eps counterparts.

>>

>> I found some references to something called svglib, but nothing since

>> 2004.

>> What is the best strategy for importing images into ReportLab so that

>> they look as crisp as possible? I have EPS versions of various logos,

>> so I could presumably save these as any size PNG files.

>>

>> Thanks,

>>

>> Mike

>>


so far as I'm aware we don't support eps in PDF. Adobe says it's deprecated so
we just don't do it. We have converted eps into PDF using various commercial
tools (and ghostscript) and we do have a proprietary tool pageCatcher for
bringing PDF into a reportlab document. You can use ghostscript to render eps
into other image formats, but they then become magnification sensitive so the
usual solution is to make them larger than needed and then let PDF reduce to the
wanted size.


> As far as I could tell when I had this problem, you have three options:

> 1) Purchase the commercial ReportLab tools, which apparently have

> methods to deal with this

> 2) Make some PNG/GIF/other bitmapped image realizing that it will be

> resized in the final PDF. I have noted that when PDFs are rendered,

> such non-vector graphics often appear strangely, but when printed those

> graphics come out fine, presuming that the DPI is good. If print and

> not screen is your target medium, perhaps this is the best option.

> 3) Use svglib. I was also put off by this notion originally, but found

> that using it is quite easy. Once you have your EPS file(s) converted

> to SVG (Ghostscript is one open source tool that can do this,

> Illustrator can save to SVG, and Inkscape (also open source) can convert

> .ai's), it's one simple function call (svg2rlg) to convert to a nice

> ReportLab flowable.

.........

--
Robin Becker


More information about the reportlab-users mailing list