Solved

Join multiple pdf documents in vb script

Posted on 2013-01-30
4
699 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Update 21-May-2015: I temporarily removed the source code to make major changes to the program. Regards, Joe INTRODUCTION This article presents a solution to a question (http://www.experts-exchange.com/Programming/Installation/Q_28396542.html)…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

13 Experts available now in Live!

Get 1:1 Help Now