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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > General Discussion
  New Posts New Posts RSS Feed - DC Resolution GetCanvasDC, GetCanvasDCEx
  FAQ FAQ  Forum Search   Register Register  Login Login

DC Resolution GetCanvasDC, GetCanvasDCEx

 Post Reply Post Reply
Author
Message
FOltean View Drop Down
Beginner
Beginner
Avatar

Joined: 08 Apr 11
Location: France
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote FOltean Quote  Post ReplyReply Direct Link To This Post Topic: DC Resolution GetCanvasDC, GetCanvasDCEx
    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.




Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 28 Nov 18 at 8:11PM
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

Back to Top
FOltean View Drop Down
Beginner
Beginner
Avatar

Joined: 08 Apr 11
Location: France
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote FOltean Quote  Post ReplyReply Direct Link To This Post Posted: 29 Nov 18 at 3:02PM
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
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 29 Nov 18 at 4:18PM
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.
Back to Top
FOltean View Drop Down
Beginner
Beginner
Avatar

Joined: 08 Apr 11
Location: France
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote FOltean Quote  Post ReplyReply Direct Link To This Post Posted: 10 Dec 18 at 10:14AM
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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store