[gdal-dev] DPI for printing in geospatial PDF

John W. Glendening glendening at drjack.net
Mon Aug 1 13:05:43 PDT 2016


A previous thread
 http://lists.osgeo.org/pipermail/gdal-dev/2015-May/041727.html
discussed the effect of the DPI parameter of the geospatial PDF
driver, one response being

 "It may be that DPI setting at the moment does not have a totally
desired
effect. It would feel natural that increasing DPI from the default value
72
into a bigger value like 300 would make the page size of the PDF smaller
expressed as physical units like millimeters."

I stumbled upon this issue because previously I'd been creating PDFs
using ImageMagick "convert".  I needed to produce page-size printed
maps of an image with having much greater resolution than Adobe's
"standard" 72 dpi so used the convert "-page" option - whereupon
letter-sized prints were automatically generated when printed using
Adobe Reader.  [Without that option the same result could be obtained
by selecting Adobe Reader's "Fit to Printable Area" Page Scaling
option - but this file will be printed by others less knowledgeable
than I so I wanted to have one less thing for them to mess up.]

When I decided to create geospatial PDFs using GDAL, the default gave
a file which again required setting "Fit to Printable Area" - so I
looked for a way of avoiding that.  Using the "DPI" option seemed the
obvious answer, but altering it did not have the expected effect -
"Fit to Printable Area" was still required, as previously found by the
poster of the previous thread.

Delving into the PDF file itself, I see the "DPI" option changes not
only the PDF "MediaBox" variable but also its "UserUnit" variable,
such that the printable size is unchanged.

To me that makes no sense, since printing of a PDF is common and in
many cases one wants to print an image at a much higher resolution
than 72 dpi.  I do understand the need to limit the size of "MediaBox"
and the use of "DPI" to reduce the "MediaBox" values.  I note that
when I use IM's convert -print option it _also_ reduces the size of
"MediaBox" - but it did _not_ change "UserUnit", hence the expected
letter-size printed page is produced by IM.

So I'd urge you to also not change the PDF's "UserUnit" when driver
option "DPI" is invoked - that would help those wanting to print
higher-resolution images.  I personally don't know of a reason
why "UserUnit" needs to be changed.

Jack Glendening

PS: personally I have a work-around - after PDF creation within a
script, a command-line editor removes the "UserUnit" parameter from
the PDF.  But it's kludgey and I think the problem would be better
addressed through the "DPI" driver option.





More information about the gdal-dev mailing list