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 > I need help - I can help
  New Posts New Posts RSS Feed - GetCanvasDC/LoadFromCanvasDC
  FAQ FAQ  Forum Search   Register Register  Login Login

GetCanvasDC/LoadFromCanvasDC

 Post Reply Post Reply
Author
Message
HNRSoftware View Drop Down
Senior Member
Senior Member


Joined: 13 Feb 11
Location: Washington, USA
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote HNRSoftware Quote  Post ReplyReply Direct Link To This Post Topic: GetCanvasDC/LoadFromCanvasDC
    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?
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 02 Oct 13 at 1:35PM
One word,    NewPageFromCanvasDC. 

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

Also 

Back to Top
HNRSoftware View Drop Down
Senior Member
Senior Member


Joined: 13 Feb 11
Location: Washington, USA
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote HNRSoftware Quote  Post ReplyReply Direct Link To This Post 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
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