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

Drawing into DC - scaling problem.

Question

Hi, I have a window, it's size is W[px] x H[px] . I would like to to draw pdf page content using RenderPageToDC. This function supports only DPI setting.

Knowing page width from PageWidth() how can I set such DPI that rendered pdf will have the same width (in pixels) as my window? I use windows api.

Answer

The PageWidth() function returns the page size in points (1/72 inch) by default.

For example, if you received a value of 612 that would mean a page width of 8.5 inches.

To display this in a window that has a width of 1024 pixels you would need to set the DPI to 1024 pixels / 8.5 inches = 120.47

The QPL rendering functions only accept integer DPI values. Using 120 in this case would result in an image that is 1020 pixels wide - so there would be a gap of 4 pixels.


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