Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Mimic Adobe's Fit Page, Fit Visible, Fit Width |
Post Reply ![]() |
Author | |
RedOctober ![]() Team Player ![]() Joined: 12 Oct 10 Status: Offline Points: 26 |
![]() ![]() ![]() ![]() ![]() Posted: 14 Oct 10 at 3:48PM |
I'm new to QuickPDF Library. I'm also new to these forums. I didn't realize that there are several different forums for Quick PDF Library. I guess I posted in the wrong one yesterday because when I returned here today, my question is no where to be seen. So here goes again...
Development Environment: Delphi 7, XP Pro, Quick PDF Library 0721 I've examined the example: QPLDelphiDemo.exe In the source code for the "View/Print" tab there is a "RenderPage" procedure that displays one page of a .Pdf, zoomed to a multiple of 25. I can get this working properly. However, I want to give my user's the same zoom options as what Adobe Reader has, including the "Named" zoom values of Actual Size, Fit Page, Fit Visible, Fit Width How do I do the calculations so that TQuickPDF will draw it to the correct zoom? I also noticed that every zoom selection is multiplied by 96. What is significant about the number 96? Thanks in advance for any help you can provide, and please let me know if I've double posted, cross posted, or what forum I should be using for asking questions about QuickPDF Library. Thanks. |
|
![]() |
|
Rowan ![]() Moderator Group ![]() ![]() Joined: 10 Jan 09 Status: Offline Points: 398 |
![]() ![]() ![]() ![]() ![]() |
Adjusting the zoom for rendered PDF files (and thus Actual Size, Fit Page, Fit Visible, Fit Width) is not the simplest of tasks. I'll try to explain.
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. In the code sample that you looked at the DPI was 96 instead of 72, but it could have been 110 or another number as well. To determine the width and height of the rendered PDF you could also take into account the page width and page height of the page in the PDF to determine how big an image placeholder you should generate in your application for the PDF. |
|
![]() |
|
RedOctober ![]() Team Player ![]() Joined: 12 Oct 10 Status: Offline Points: 26 |
![]() ![]() ![]() ![]() ![]() |
Thank you Rowan. I think I'm starting to understand, not to get too hung up about pixels (just because the sample code was based on pixels). However in your response you say:
"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." What is the page rendering command I can use to accomplish what you say in the quoted statement? Thanks in advance. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store