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!
![]() |
LoadFromCanvasDC Question |
Post Reply
|
| Author | |
Syllus
Beginner
Joined: 19 Oct 09 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: LoadFromCanvasDC QuestionPosted: 20 Oct 09 at 7:08PM |
|
I am trying to create a HDC that can then have an image drawn on it through GDI commands (from one of our other applications) then pull that in as an image to be placed into a pdf creted with QuickPDF. I saw this post where it was stated that the OP could use GetCanvasDC to get a DC handle, then use PlayEnhMetafile to draw a metafile's contents onto it, then use LoadFromCanvasDC to obtain a handle to a loaded image that could then be placed onto the PDF where ever needed.
This is the exact type of functionality I need with the exception of , I would use our drawing routines to draw the image to the DC instead of playing back a metafile. What I do not understand, is how you get a loaded image from LoadFromCanvasDC(), or more specifically, a handle to a loaded image. All that the actual LoadFromCanvasDC function seems to return is an integer representing a success or failure (0 or 1). If this is in fact an accurate statement about obtaining a loaded image from LoadFromCanvasDC, and having a handle to it that can be used to draw it throughout the PDF, could anyone please explain to me how you get the loaded image and said handle?
Currently whenever I try to make a call to LoadFromCanvasDC it seems like it recreates the whole PDF DOC as that image instead of giving me any kind of usable image that can then be placed. As in, the entire PDF document then takes on the size and dimensions of the created DC during GetCanvasDC. And of course if this is not the correct method to do something like this, any advice / nudge in the right direction would be greatly appreciated.
Thanks in advance.
|
|
![]() |
|
Syllus
Beginner
Joined: 19 Oct 09 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 20 Oct 09 at 11:31PM |
|
Ok, quick update, after some more experimentation I found that by using the LoadFromCanvasDC() method it was actually adding a 2nd document to the instance of the PDF Library, by simply keeping a handle on the originl document I could then merge the 2nd document (drawing from the DC) and then capture the page, then i could use the DrawCapturedPage() method to draw the dc image where ever I wanted on the main document. (which was now the only document as the 2nd one was deleted as a by-product of the earlier operations). I do not know if this is the intended method for this type of procedure, it is just what I have found that works so far...
If there is a better way to bring in an image from a device context that was drawn directly to the DC by GDI commands, any nudges in the right direction are greatly appreciated.
Again, thanks in advance.
|
|
![]() |
|
DELBEKE
Debenu Quick PDF Library Expert
Joined: 31 Oct 05 Location: France Status: Offline Points: 151 |
Post Options
Thanks(0)
Quote Reply
Posted: 21 Oct 09 at 9:56AM |
|
Hi Syllus, welcome here
Found in the help
Debenu is actualy working around this functions and the next release will have enhancements. Edited by DELBEKE - 21 Oct 09 at 10:00AM |
|
![]() |
|
Syllus
Beginner
Joined: 19 Oct 09 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 21 Oct 09 at 3:08PM |
|
Hey Delbeke, thanks for the reply. Yes I am already doing this... I am currently using GetCanvasDC to create a DC which i then pass along to be drawn on by the win32 drawing commands of our other application, once that is done I use LoadFromCanvasDC... what I was expecting based on the other post I read was for that drawing to be then be loaded in as an image.
However the questions arose once I realized that this was not the case and that it was in fact creating a new document. It appeared at first as though it were replacing my old document. (this was before I realized that multiple documents could exist within a single instance of the PDFLib), once I realized that I started looking at the document management methods and experimenting with Doc merging, and page capturing, which seems to be working quite well at the moment.
It is looking like this library may be very well suited for our needs, another day of testing should show for sure.
Thanks :) Edited by Syllus - 21 Oct 09 at 3:28PM |
|
![]() |
|
DELBEKE
Debenu Quick PDF Library Expert
Joined: 31 Oct 05 Location: France Status: Offline Points: 151 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 Oct 09 at 7:01AM |
|
There is an other way. First you draw in an enhance metafile and save it to an emf file. Then you load the emf file with Qp.AddImageFromFile. Then, you can draw the image with Qp.DrawImage anywhere in your current document.
|
|
![]() |
|
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