Solved

Join multiple pdf documents in vb script

Posted on 2013-01-30
4
706 Views
Last Modified: 2013-01-31
Hi,

I have vb script to join two pdf documents together. Works great. I can't seem to expand the code to join three (or more) pdf docs together. Each pdf is one page.

I have
Dim Doc1
Dim Doc2
Dim Doc3

Set Doc1 = CreateObject("AcroExch.PDDoc")
Set Doc2 = CreateObject("AcroExch.PDDoc")
Set Doc3 = CreateObject("AcroExch.PDDoc")



file1 = Doc1.Open("C:\ods_outputs\alc_daily_summary_tables.pdf")
file2 = Doc2.Open("C:\ods_outputs\discharge destinations.pdf")
file3 = Doc3.Open("C:\ods_outputs\alc_daily_graphs.pdf")
Stack = Doc1.InsertPages(Doc1.GetNumPages - 1, Doc2, Doc2.GetNumPages,0, Doc3, 0, Doc3.GetNumPages,0)

SaveStack = Doc1.Save(1, "C:\Users\LB\Desktop\Daily v2.pdf")

I get error: wrong number of arguments or invalid property assignment.
I can't find the meaning of the arguments...If you could explain them, that would help.

Can you help me straighten this out.

Thanks,

Bruce
0
Comment
Question by:Diaphanosoma
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
agonza07 earned 300 total points
ID: 38838329
Looks like you have the wrong number of arguments on the "Doc1.InsertPages" command.

http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Acrobat9_HTMLHelp&file=IAC_API_OLE_Objects.103.2.html#1526000

Probably, would be best to take a tiered approach. Merge doc 1 and doc 2 to create doc 3. then merge doc 3 and doc 4 to creat doc 5.
0
 
LVL 44

Assisted Solution

by:Karl Heinz Kremer
Karl Heinz Kremer earned 200 total points
ID: 38839022
You need two calls,to InsetPages, one to insert the pages from Doc2 into Doc1, and another one to insert the pages from Doc3 into the now modified Doc2.
The parameters for InsertPages are described here:  http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/IAC_API_OLE_Objects.103.118.html
0
 
LVL 1

Author Comment

by:Diaphanosoma
ID: 38839381
I'll give it a go. I thought trying that last night... but it seemed "lame".
0
 
LVL 1

Author Closing Comment

by:Diaphanosoma
ID: 38839477
Points for everyone. Agonza gets more for being up so late!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Inserting page numbers in Portable Document Files not only enhances manageability but also makes them look professional. With numbered pages, the file appears more organized and it becomes easier to search for a particular page. The size and the vol…
In this video, we show how to perform Bates Numbering/Stamping of PDF documents using Power PDF Advanced, the newest product from the Document Imaging division of Nuance Communications. There are two editions of Power PDF — Standard and Advanced. Th…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now