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 > General Discussion
  New Posts New Posts RSS Feed - Create a new PDF from N templates
  FAQ FAQ  Forum Search   Register Register  Login Login

Create a new PDF from N templates

 Post Reply Post Reply
Author
Message
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Topic: Create a new PDF from N templates
    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 ?

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 02 Jan 06 at 4:15PM
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

Back to Top
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 06 at 6:52AM

Tried this upon VBScript :

OPTION EXPLICIT

DIM objMyForm,status

Set objMyForm = WScript.CreateObject("ISED.QUICKPDF")

objMyForm.unlockkey("mykey")
status=objMyForm.ClearFileList("mfl")

But status will always return 0 whereas it should return 1.

Any hint ?

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 06 at 7:00AM
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

Back to Top
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 06 at 7:09AM
Perfect !

Now it's working.

Once more, thank you so much !
Back to Top
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 06 at 8:12AM
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.




Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 06 at 9:04AM
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

Back to Top
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 06 at 10:43AM
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 ?

Back to Top
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 06 at 11:53AM
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 ?
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