Solved

Join multiple pdf documents in vb script

Posted on 2013-01-30
4
712 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article is in response to a question here (http://www.experts-exchange.com/Other/URLs/Q_28283850.html) at Experts Exchange. The Original Poster has a scanned signature and wants to make the background transparent so that the signature may be pl…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In this third video of the Xpdf series, we discuss and demonstrate the PDFtoText utility, which converts PDF files into plain text files. Download and install the software.: You may have already downloaded and installed the Xpdf tools while watching…
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…

735 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