Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge multiple PDF files with VBScript

I'm looking for a way to merge multiple PDF files into one with VBScript, only with Acrobat and Distiller - without using any third-party software. Although I really searched hard for a solution on the web, I couldn't find one. Can someone please help me out here?

Thank you! S.

like image 636
Sam Avatar asked Jul 19 '26 00:07

Sam


1 Answers

I've had success in the past using Acrobat's Interapplication Communication feature from VBScript. I don't have a full version of Acrobat to test with, but this should at least give you a starting point:

Dim app
Set app = CreateObject("AcroExch.App")

Dim srcDoc, destDoc
Set srcDoc = CreateObject("AcroExch.PDDoc")
Set destDoc = CreateObject("AcroExch.PDDoc")

srcDoc.Open srcPath
destDoc.Create
destDoc.InsertPages 0, srcDoc, 0, srcDoc.GetNumPages(), 0
destDoc.Save 0, destPath

srcDoc.Close
destDoc.Close
app.Exit

The OLE Automation section of the API reference contains a list of the available classes and methods.

like image 112
Cheran Shunmugavel Avatar answered Jul 21 '26 22:07

Cheran Shunmugavel