Print Page | Close Window

GetCanvasDC/LoadFromCanvasDC

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2744
Printed Date: 31 Jan 26 at 9:18PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: GetCanvasDC/LoadFromCanvasDC
Posted By: HNRSoftware
Subject: GetCanvasDC/LoadFromCanvasDC
Date Posted: 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?



Replies:
Posted By: AndrewC
Date Posted: 02 Oct 13 at 1:35PM
One word,    NewPageFromCanvasDC. 

This function is used to add subsequent pages to an existing document.

Also 

http://www.quickpdf.org/forum/metafile-to-pdf_topic2741.html" rel="nofollow - http://www.quickpdf.org/forum/metafile-to-pdf_topic2741.html

Andrew.


Posted By: HNRSoftware
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk