Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

I want to draw an image onto a PDF, but the page size is in millimeters and the image size in pixels, so how do I draw the image to scale?

Question

I want to draw an image onto a PDF, but the page size is in millimeters and the image size in pixels, so how do I draw the image to scale?

Answer

The answer is this question is a little complicated, so we've tried to provide a well rounded answer with some background information.

If you have a 100 pixel x 100 pixel image and you draw it into a 100mm x 100mm area on the page the result will be an image with a DPI of 25.4.

If you want to have a 1 image pixel to 1 screen pixel mapping at 100% zoom in Acrobat or another PDF viewer then the image needs to be drawn at 72 DPI.

For a 100 pixel image to be shown with a 1:1 pixel mapping at 100% zoom needs to be drawn at (100 / 72) x 25.4 = 35.278mm.

It does depend on the PDF viewer. If the user changes their DPI settings then there isn't anything the PDF creator can do to know that.

For example, in Adobe Reader 9, Edit / Preferences / Page Display, I have the DPI set to 110 on my system by running in "Large screen fonts" mode in Windows when I installed Adobe Reader. However, any value can be selected here.

Essentially, there is no way to force the user to view the bitmaps on a page at a certain zoom level.

So the pixel size of an image really isn't useful when doing layout. You just specify the size in mm (or whatever the page measurement units is set to) and the image will appear in that area regardless of the number of pixels.


© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum