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!
![]() |
Problem Rendering PDF w/ Windows Scale is not 100% |
Post Reply ![]() |
Author | |
waynefulcher ![]() Senior Member ![]() ![]() Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
![]() ![]() ![]() ![]() ![]() Posted: 02 Mar 21 at 10:54PM |
I am using Delphi 7 and the QuickPDF Library (version 16.13).
In my code I am calling the RenderPageToFile() method. I have tested this with many different parameters but the combination that I can not get to work correctly just happens to be the only option I actually need. So if I render the page passing in the Option/Format as 8 (EMF+) it works perfectly fine, UNLESS you right-click your windows desktop and select Display Settings and then change your scale to something other than 100%. I tested with 150%. Then when rendering as EMF+ the content on the page is not correctly scaled. So for example if the PDF has a paragraph of text that basically goes from side to side of a letter size page then if Windows Scale is 150% and page is rendered as EMF+ then the text shrinks to only about half the width of the page. If I test other formats, such as 1 (JPEG) then it seems to still scale the content on the page correctly even when Windows scale is at 150%. Anyone have any idea how I might be able to fix this? Thanks |
|
![]() |
|
tfrost ![]() Senior Member ![]() Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
![]() ![]() ![]() ![]() ![]() |
Rendering to EMF is a problem because EMF seems to always need a reference DPI from a printer or screen, as you have found. However you should be able to simply check the screen DPI before rendering, and adjust the DPI when you render. Things get more complicated when you have screens of different resolutions in use, especially if the window has been moved from one to another, or if you are writing a service application without a window. The DPI of the primary monitor may be the one you want, but experimentation and testing are essential.
Using one of the other renderers supported by QPDF may also help (see SelectRenderer in the documentation). However this involves distributing an extra DLL with your application. And note that DPLPDFIUM may not be thread-safe.
|
|
![]() |
|
waynefulcher ![]() Senior Member ![]() ![]() Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
![]() ![]() ![]() ![]() ![]() |
Thanks for your feed back I will look into the SelectRenderer to see if that can provide any help.
But as to the comment about DPI, that is not exactly how that works. The DPI and Scale is slightly two different things. For example in the call to RenderPageToFile() it has a DPI parameter which I pass in, I have tested with many different values and the only difference it makes is how clear the results are and the size of the output. So 60 is blurry but the size is very small (not visually), 150 dpi is a good balance between clarity but not too big in size then as you try 300 or 600 the clarity gets slightly improved but the size of the output is very large. The problem is the scale of the rendering to the size of the page. So something in rendering must be using one DPI for the width/height of the page and something different for the content. The issue here actually seems to be a Windows issue and whatever GDI+ driver that is installed with windows. In searching I have read about many other applications having the same sort of problem with Scale (not DPI). Oddly enough Microsoft used to supply a checkbox to correct the issue in their display settings back in Windows 7 but that checkbox does not exists in Windows 10. So I guess I will try to see if windows has a fix for Windows 10 or if I can somehow use a different renderer but that seems like any other renderer will also rely on the GDI+ libraries installed on the computer which most likely means they probably all will have the same issue. If I find a solution I will come back and post it for other to use. Thanks again. |
|
![]() |
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