[reportlab-users] PDF Document Resolution

J. R. Carroll jrcarroll at jrcresearch.net
Sat Mar 2 14:00:00 EST 2013



>From my understanding PDF native/default is 72dpi. Because PDF is vector

based, 72dpi is a loose resolution. Meaning you can "zoom in" as close as
you want to increase the resolution and the PDF redraws all post-script
elements. HOWEVER, it is also my understanding, I hope I am not
misrepresenting PDF/PS/Reportlab (so if someone else knows better, chime
in), that when you embed images, THOSE ARE NOT at the native PDF resolution
(they embed at whatever resolution you made them in) so if you want a PDF
that has a higher resolution, you need to consider the images (or whatever
the non-naitive PS elements are) in your document and calculate accordingly.

If I am understanding the appended
SO<http://stackoverflow.com/questions/8893928/how-can-i-improve-reportlab-image-quality>
explanation
on how you can do a backwards calculation on dpi of your rasterized images,
you can do the following:

*Goal:* 300dpi PDF for printing,

*
*


> *How large do you want your image to be when you print it?* 4" wide.



Since you'll be "shrinking" (resizing) the image down from a higher "point
per unit" value, you would want to make a much larger rasterized image
(higher resolution) before embedding it.
*
*


> *Simple algebra: **desired_pdf_image_width * desired_dpi_on_PDF = Number

> of pixels wide you want to make your original image*



4 inches wide * 300dpi = *1200px wide original image.*

Then slap it in your PDF and have a go at it. So when you take that 1200px
image and scale it down in ReportLab to 4", it'll be 300dpi.

*Additionally/alternatively:* You can turn up the native resolution of the
PDF in whatever rendering program you are using (most support it). But
turning up the rendering resolution only recalculates the vector based PS
elements (not rasterized elements). If you want to avoid up-scaling images
prior to PDF generation then stick with SVG/Vector based graphics.

*Why are retina displays increasing use of SVG images?*

> The latest Apple iPads and Macbooks are equipped with 'retina' displays –

> very high resolution screens that result in a high quality experience for

> viewers. However, static size textures and bitmaps – how charts and logos

> are currently displayed – are suffering, as they can look fuzzy and shoddy

> on these new displays. One workaround is to use vector graphics – images

> that keep their sharpness no matter the image size. ReportLab's graphics

> module can output fully resizeable SVG images. This makes it an even better

> solution for financial charts on web sites."



I also recommend you read the thread by the "ReportLab
people<http://two.pairlist.net/pipermail/reportlab-users/2003-August/001888.html>"
regarding this same question found in the achieves.


*Sources*:
http://stackoverflow.com/questions/8893928/how-can-i-improve-reportlab-image-quality
http://ask.metafilter.com/68934/What-the-resolution-for-this-pdf-file
http://www.reportlab.com/software/documentation/relnotes/26/
http://two.pairlist.net/pipermail/reportlab-users/2003-August/001888.html


Anyone else want to cleanup my understanding? I'm still mastering these
concepts (my apologies if this or any part is incorrect).

HTH

/jrc

----


J. R. Carroll
Independent Researcher through Hurtz Labs
Research Methods, Test Development, and Statistics
www.jrcresearch.net
www.ontvp.com
Cell: (650) 776-6613
Email: jrcarroll at jrcresearch.net
jrcarroll at hurtzlab.com
jrc.csus at gmail.com
<https://www.facebook.com/J.R.Car>
<https://twitter.com/jNammer><http://www.linkedin.com/in/jrcarroll>



On Sat, Mar 2, 2013 at 9:34 AM, Perry Ratcliff
<perry.ratcliff at hotmail.com>wrote:


> I am converting a Visual Basic Project to Python (and eventually

> Django). This project requires printing graphics at a high resolution.

>

> So far, it appears that ReportLab only supports generation of PDF

> Documents at 72 dpi.

>

> Is there any way to set the document resolution at 300 or 600 dpi?

>

> Thanks,

>

> Perry

>

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20130302/eeda0ee7/attachment.htm>


More information about the reportlab-users mailing list