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!
![]() |
GetCanvasDC/LoadFromCanvasDC |
Post Reply
|
| Author | |
HNRSoftware
Senior Member
Joined: 13 Feb 11 Location: Washington, USA Status: Offline Points: 88 |
Post Options
Thanks(0)
Quote Reply
Topic: GetCanvasDC/LoadFromCanvasDCPosted: 01 Oct 13 at 2:32PM |
|
First an aside - After several years of using the Quick PDF library with Delphi, I have found extremely few bugs, and I have found that the library will do virtually anything that needs to be done with pdf files. The tricky part is discovering which calls to use and placing them in the proper sequence..... I have found that the Reference Help file is seldom wrong, but frequently doesn't say quite enough (READ EVERY WORD OF THE CALL HELP PAGE). The Developer Guide has much useful context, but not every task. The search feature on the forum is very useful in filling in the gaps. (Note - I am still using version 8 of the library).
The situation: I have 20 years of library code for Delphi that manipulates TCanvas and TCanvas-based components. Although QuickPDF has many functions that duplicate TCanvas operations, it would be useful to be able to treat a pdf page (conceptually) as a TCanvas, wrap some context around it and be able to alternately write/draw to a TImage and a sort of a "TPDFFilePage". The GetCanvasDC/LoadFromCanvasDC pair of calls seem to be the tools I have to work with, and a surprisingly small amount of trial and error has them working successfully, including creating a page with TCanvas operations, and then using QuickPDF drawing operations afterwards. The difficulty I am having is in the "big picture" - creating a pdf file of multiple pages, where each page is created with TCanvas operations, and it is the TCanvas-level code that decides it is time to move to a new page. The confusing (to me) aspect of LoadFromCanvasDC is that it creates a "document" not a "page". As best as I can guess, the document can only consist of one "page", sized by setting a number of dots wide and tall (based on an implicit dots per inch) in the GetCanvasDC call, and turning it into explicit measurements which will wind up in the pdf file when this TCanvas is converted during the "LoadFromCanvasDC" call which uses an explicit DPI value. OK, I get this - makes sense. The question for me is "What calls should I use to assemble this "document" of 1 page into a PDF file of multiple pages?" -- One approach would be to create a bunch of individual page pdf files and then join them together. Just browsing the reference file comes up with "MergeDocument" which seems likely, but the Developer Guide example is oriented to multiple pdf files on disk rather than in memory. I may just not be seeing the proper example. Any suggestions on where to look? |
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 02 Oct 13 at 1:35PM |
|
One word, NewPageFromCanvasDC.
This function is used to add subsequent pages to an existing document. Also |
|
![]() |
|
HNRSoftware
Senior Member
Joined: 13 Feb 11 Location: Washington, USA Status: Offline Points: 88 |
Post Options
Thanks(0)
Quote Reply
Posted: 02 Oct 13 at 1:41PM |
|
Hi Andrew - thanks - not sure how I missed that. Like I said, the library does virtually everything I could want, but the trick is to select the right calls and use them correctly. - Howard
|
|
![]() |
|
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