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!
Create a new PDF from N templates |
Post Reply |
Author | |
jabaltie
Senior Member Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
Post Options
Thanks(0)
Posted: 02 Jan 06 at 12:16PM |
I'd like to combine several PDF templates into a new output PDF file.
Each PDF template would ALWAYS contain a single page. So, this is an algorithm of what's needed: Create a new, blank , empty Document For PageNo=1 to nPages Create Page # PageNo Add page from template # PageNo Next Save Final document, with nPages How can I do it ? Is it conceptually OK to do it ? |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi!
Why you don't want to merge the complete files? Here's an easy example how to merge three files to a new one (delphi 5): . . . QP := TiSEDQuickPDF.Create; try QP.UnlockKey('MyLicenseKey'); QP.ClearFileList('mfl'); QP.AddToFileList('mfl', file1); QP.AddToFileList('mfl', file2); QP.AddToFileList('mfl', file3); finally QP.MergeFileList('mfl', filenew); QP.Free; file1 := ''; file2 := ''; file3 := ''; filenew := ''; end; . . . |
|
Cheers,
Ingo |
|
jabaltie
Senior Member Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
Post Options
Thanks(0)
|
Tried this upon VBScript : OPTION EXPLICIT DIM objMyForm,status Set objMyForm = WScript.CreateObject("ISED.QUICKPDF") objMyForm.unlockkey("mykey") But status will always return 0 whereas it should return 1. Any hint ? |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi!
You just start and want to clear a filelist which doesn't exist at that moment. So ClearFileList returns with 0 'cause there isn't a filelist. |
|
Cheers,
Ingo |
|
jabaltie
Senior Member Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
Post Options
Thanks(0)
|
Perfect !
Now it's working. Once more, thank you so much ! |
|
jabaltie
Senior Member Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
Post Options
Thanks(0)
|
Ops !
Not everything is working... The problem is that after merging, the List of Fields seems to reflect only the first added PDF file and not all the fields from all of them. How can I abstract the whole list of fields ? Should I switch between pages ? I tried it but it didnt work. The thing is that I need to "see" all of the fields so that I can to a FOR/NEXT replacing their contents by their corresponding values. |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi!
We had this already... I think there fields in the several documents with same names... Each name must have a unique name. |
|
Cheers,
Ingo |
|
jabaltie
Senior Member Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
Post Options
Thanks(0)
|
Yeah, I thought about that too.
It's not the case though. All of the field names are absolute, that is, unique, amongst all of the files. What if I open a new document, and then add page per page and substitute the fields page per page ? |
|
jabaltie
Senior Member Joined: 08 Nov 05 Location: Brazil Status: Offline Points: 138 |
Post Options
Thanks(0)
|
Below is a script where I tried to add page per page and substitute field contents page per page. Also merge is done page per page.
Final result ? Blank PDF with N pages. OPTION EXPLICIT DIM objPDF,docPDF,docpage,lni Set OBJPDF = WScript.CreateObject("ISED.QUICKPDF") WScript.Echo "UnlockKey ",objPDF.unlockkey("mykey") docPDF=OBJPDF.NewDocument() WScript.Echo "doc id 1 ",docPDF WScript.Echo "Load File ",OBJPDF.LoadFromFile("TEST.PDF") docpage=objPDF.DocumentID(1) WScript.Echo "doc id 2 ",docpage WScript.Echo "field CNT ",objPDF.FormFieldCount for lni=1 to objPDF.FormFieldCount WScript.Echo objPDF.GetFormFieldTitle(lni) next WScript.Echo "set form f", objPDF.SetFormFieldValueByTitle("TCOVERBO","X") WScript.Echo "select doc",objPDF.SelectDocument(docPDF) WScript.Echo "Merge ",objPDF.MergeDocument(docpage) WScript.Echo "save ",objPDF.SaveToFile("C:\TEMP\TEST.PDF") What could be wrong ? |
|
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