CSS-based PDF: Changes to DPI

mdslup
Posts: 126
Joined: Tue Mar 06, 2018 1:34 am

CSS-based PDF: Changes to DPI

Post by mdslup » Tue Aug 07, 2018 12:05 am

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

Dan
Posts: 415
Joined: Mon Feb 03, 2003 10:56 am

Re: CSS-based PDF: Changes to DPI

Post by Dan » Tue Aug 07, 2018 10:49 am

Hello,

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 https://www.oxygenxml.com/doc/versions/ ... phics.html

Regards,
Dan

mdslup
Posts: 126
Joined: Tue Mar 06, 2018 1:34 am

Re: CSS-based PDF: Changes to DPI

Post by mdslup » Wed Aug 08, 2018 9:33 pm

I will send an email.

mdslup
Posts: 126
Joined: Tue Mar 06, 2018 1:34 am

Re: CSS-based PDF: Changes to DPI

Post by mdslup » Wed Aug 08, 2018 10:04 pm

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;
}

Costin
Posts: 603
Joined: Mon Dec 05, 2011 6:04 pm

Re: CSS-based PDF: Changes to DPI

Post by Costin » Thu Aug 09, 2018 11:02 am

Hello,

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,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

Post Reply