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!
DrawCapturedPage to create PDF w/combined content |
Post Reply |
Author | |
cowboy
Beginner Joined: 07 Jun 21 Status: Offline Points: 5 |
Post Options
Thanks(0)
Posted: 07 Jun 21 at 10:35PM |
Greetings! Background, I'm using an older version of QuickPDF 8.12 with PowerBasic and have been trying to upgrade since Christmas but had difficulties. I am presently in contact with FoxIt and hope to be able to upgrade before too long, if for no other reason than fixing a problem where the HTML commands hang. (I held out as long as I could just because it is a pain to recreate the PowerBasic include files!) Onward, here what I trying to accomplish in the form of an example: Page 1 - Original content created by QuickPDF (text, graphics, etc.) - No problems here. Page 2 and 3 - Embed / capture an external PDF and add my footers to both pages Page 4+ - Original content continues Now I've used QuickPDF on a few little projects and have been able to create content without major problems. I respectably fluent in the GDI and GDI+ and have written to the screen / graphics and printers for years. (Well, decades but don't tell anyone!) The embedding is the problem. The technique that I've been trying has been to using this psudo-code. Assume no errors returned unless otherwise stated:
This technique doesn't work because I just get a 0 for the result of drawCapturedPage () every time.This seems, to me, to be the cleanest most direct method, to process one file at a time as it comes up, especially since there will end up being more than one pdf to "include", such as new2.pdf, new3.pdf and so forth. I also think that this is the correct method because I have made drawCapturedPage work when I preload a documents to import before generating any content. Here's what I do at the beginning:
I can confirm the array management is correct. The following is an excerpt from my log file: Preload 1:[.\GROUT2.pdf] = 1476395010 ::: Pg 1> 1476395011 Preload 2:[.\GROUP3.pdf] = 1476395012 ::: Pg 1> 1476395013 Start new file Embed fonts Process row heights Generating output Draw 1:[.\GROUT2.pdf] = 1476395010 ::: Pg 1> 1476395011/0 Draw 2:[.\GROUP3.pdf] = 1476395012 ::: Pg 1> 1476395013/1 1476395010 is documentID(1) and 1476395011 is capturedPages ( 1, 1 ) /0 means drawCapturedPage failed 1476395012 is documentID(2) and 1476395013 is capturedPages ( 2, 1 ) /1 means drawCapturedPage worked And the results mirror the result code. Document 1 will not drawCapturePaged() while Document 2 is draws exactly as expected and I'm able to overlay text on top. Works perfectly! So, one fundamental question. Can more than one PDF be loaded at a time? It would seem that it is possible since the getDocumentID () function has an index which would suggest this. I have not found a way to validate whether the handle for a document is valid but since I have not called removeDocument(), I would assume it is still valid. Also, I realize that I have not taken into consideration the typefaces uses in the PDFs that I am bringing in. I see the findFonts() function is where I need to start but I've got to figure out what to do next with that. Anyhow, I am sorry for this being long but my goal is to be thorough. Any input, thoughts or experience would be greatly appreciated! Cowboy Edited: corrected "/0" to "/1 means drawCapturedPage worked" Edited by cowboy - 08 Jun 21 at 12:05AM |
|
cowboy
Beginner Joined: 07 Jun 21 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Addendum: I have used the documentCount() function and just verified that the document count increments when file is sent to loadFromFile() Then I wrote little test piece to get the ID of each by index, select by ID and get each filename and that seems to work fine. This seems to confirm that I can have more than document in memory. Addendum 2: I have also swapped the files to eliminate the possibility of a defective PDF file and it is only the last file that processes correctly.
Edited by cowboy - 07 Jun 21 at 11:03PM |
|
cowboy
Beginner Joined: 07 Jun 21 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Addendum: I was finally able to purchase the upgrade to 18.11 and have the program compiling but I don't see any difference in the includes but the HTMLheight has not given me any problems, so that's progress. I'm exploring how complicated it would be to generate each page of the PDF as a separate file and try assembling them at the end. I don't know how well that will work in the end but it's something to try. |
|
cowboy
Beginner Joined: 07 Jun 21 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Well, I mostly have this working, but it is cumbersome. Basically, I'm generating content on blocks and saving each as a temp file. If there is have original content to create from blank pages, I'll save it as a file. If there are files that need to be imported, I'll load them, draw on it as needed and save each as their own temp files. The process continues until all of the blocks are created then I merge them in order. On the plus side, bookmarks seem to be retained, so that is good. Speed really hasn't proven to be an issue. The only disadvantage to all of these files is that is tough keeping track of when new pages must be added because the library creates a blank page on its own and thus I end up with extra pages. Had I written for this from the beginning, it might have been less of a problem. Anyhow, I submit that as one possible solution in case someone else is running into a similar issue. |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3527 |
Post Options
Thanks(0)
|
Hi Cowboy ;-)
If DrawCapturedPage returns with a 0 then the CapturedID is wrong. As a hint: After each function call you can insert a LastErrorCode to get a more detailed error code from the call before. Here a thread that could be helpful for you i hope... http://www.quickpdf.org/forum/capturepage-then-use-on-newdocument_topic2099.html Cheers and welcome here, Ingo |
|
Cheers,
Ingo |
|
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