Solved

Join multiple pdf documents in vb script

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…
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…

636 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