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!
DC Resolution GetCanvasDC, GetCanvasDCEx |
Post Reply |
Author | |
FOltean
Beginner Joined: 08 Apr 11 Location: France Status: Offline Points: 8 |
Post Options
Thanks(0)
Posted: 28 Nov 18 at 3:17PM |
Hello everybody,
I use Delphi 2007 and RAD10.2.3 and QuickPDF 14.11. The idea is to create PDF files by painting on the Canvas at a given resolution. I tried the following: First I used GetCanvasDC and the resolution is the screen resolution 96 DPI. Then I used GetCanvasDCEx, provided the handle of a printer device context and the resultion is the same as the printer resolution 300 DPI. if Printer <> nil then DC := QP.GetCanvasDCEx(WidthPixels, HeightPixels, Printer.Canvas.Handle) //wil have the printer DPI (300) else DC := QP.GetCanvasDC(WidthPixels, HeightPixels) ; //will have the screen DPI (96) But is it possible to set the DC resolution without "cheating" by using a printer DC ? Thanks, Florin O. |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Florin,
i don't know in detail what you're wanting but i've used the enhanced search function (above, on the right side here) with "printer DC canvas height" and found some search results. Perhaps you'll find the neede information inside: http://www.quickpdf.org/forum/forum_posts.asp?TID=2741&KW=printer+DC+canvas+height&PID=11246&title=metafile-to-pdf#11246 http://www.quickpdf.org/forum/forum_posts.asp?TID=2603&KW=printer+DC+canvas+height&PID=10742&title=problem-with-text#10742 http://www.quickpdf.org/forum/forum_posts.asp?TID=1921&KW=printer+DC+canvas+height&PID=8201&title=yellow-images-from-canvas-dc#8201 Cheers and welcome here, Ingo Edited by Ingo - 28 Nov 18 at 8:12PM |
|
Cheers,
Ingo |
|
FOltean
Beginner Joined: 08 Apr 11 Location: France Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Hello Ingo and thank you for your answer.
>>I don't know in detail what you're wanting I want to create PDF files having a resolution higher than 96 DPI. As I said GetCanvasDC will return a DC having only 96 DPI, like the screen. Using GetCanvasDCEx it is possible to have a higher resolution, but a printer has to be installed on the PC. I would like to know if it is possible to specify the resolution when creating the CanvasDC. Otherwise all works perfect for me, just that at 96 DPI the curves are not very nice. Best regards, Florin
|
|
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
|
What I do is create a bitmap at whatever is the required resolution. Then you can load or paint into it whatever you want. If you want to keep your code really simple and clear, you can save the BMP to a stream, load the image from the stream using standard QPDF functions, and paint the image to the page using DrawImage or DrawScaledImage. Otherwise you can play around at the device context level and perhaps save a millisecond or two and some memory, but I find that generally takes more research than I have time for to get the details exactly right and avoid memory leaks. And most of the images I want to place on a page are already in file or stream format anyway. Sometimes the higher-level functions make sense.
|
|
FOltean
Beginner Joined: 08 Apr 11 Location: France Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Hi tfrost and thank you.
I forgot to mention that I create vectorial PDF files, so drawing on a bitmap is not an option. When using the default screen resolution of 96 DPI the curves are not very smooth. But at 300 DPI (when I create a DC based on a printer DC) the curves are very nice. Best regards
|
|
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