Page 1 of 1

CSS-based PDF: Changes to DPI

Posted: Tue Aug 07, 2018 12:05 am
by mdslup
My source image is 400x300, with both horizontal and vertical resolutions of 300 DPI.

When I transform using the CSS-PDF scenario, the images get changed to 140 DPI. This makes the images bigger than I want in the PDF. I verified this by:

* Confirming that the merged file had links to the images with the correct DPI
* Extracting the image from the PDF and verifying that its DPI had been changed

Re: CSS-based PDF: Changes to DPI

Posted: Tue Aug 07, 2018 10:49 am
by Dan

What image format are you using? Can you send us a sample image file? You are using it in the topic content, or to decorate the page background or headers?
We have tested with PNG images (created with GIMP) and it works fine.
For more information see the "Image Resolution" section from ... phics.html


Re: CSS-based PDF: Changes to DPI

Posted: Wed Aug 08, 2018 9:33 pm
by mdslup
I will send an email.

Re: CSS-based PDF: Changes to DPI

Posted: Wed Aug 08, 2018 10:04 pm
by mdslup
OK, I fixed this, but still feel like I shouldn't have had to do this.

My jpg image is specified as 300 dpi. The pdf transform is changing the pdi. I used the following css to force the pdi to 300 dpi:

*[class ~= "topic/image"] {
image-resolution: 300dpi;

Re: CSS-based PDF: Changes to DPI

Posted: Thu Aug 09, 2018 11:02 am
by Costin

I just checked the image size and even the image in the PDF you obtained (in the output you sent us by email) has the right PPI - 300.
BTW, "DPI" (which stands for Dots Per Inch and is only used to express how many dots of ink per inch can be printed, depending on the quality of each physical printer) is incorrectly used by software companies to refer the size of an image in pixels.

I also tried running both the DITA Map PDF - based on CSS predefined scenarios (with/without HTML5), with no customization CSS and obtained a perfectly sized image of 300 x 300 ppi in both cases.
However, I am using Adobe Acrobat Reader DC - version 2018.011.20055 so I could only copy the image (not save as) from the PDF in a third party software then saved it without altering its dimension or resolution.

Could you try to publish your PDF using the predefined scenario, without using a customization CSS at all and see if this changes anything?
In case that even when using the out-of-the-box scenario, after you save the image you notice that it has incorrect PPI (BTW, what exactly are you using to inspect the PPI of the saved image?), then this could be related to the PDF viewer you are using to save the image from.

More specific, you may be using a different version of Acrobat Reader (probably the Professional edition?!) and the issue could occur during the saving of the image (could be related on how the image is saved by your PDF viewer software, so you should check if there are any options/preferences at save time).

Best Regards,