' Copyright (c) 2021 ActivePDF, Inc. ' ActivePDF Toolkit 2018 ' Example generated 03/08/21 Dim FSO, strPath, intOpenOutputFile, arrayFiles, _ intMergeFiles ' Get current path Set FSO = CreateObject("Scripting.FileSystemObject") strPath = FSO.GetFile(Wscript.ScriptFullName).ParentFolder & "\" Set FSO = Nothing ' Instantiate Object Set oTK = CreateObject("APToolkit.Object") ' Create the new PDF file intOpenOutputFile = oTK.OpenOutputFile(strPath & "new.pdf") If intOpenOutputFile <> 0 Then ErrorHandler "OpenOutputFile", intOpenOutputFile End If ' Set whether the fields should be read only in the output PDF ' 0 leave fields as they are, 1 mark all fields as read-only ' Fields set with SetFormFieldData will not be effected oTK.ReadOnlyOnMerge = 1 ' Create array of the file paths to merge arrayFiles = array(strPath & "cover.pdf", strPath & "5pageLI.pdf", strPath & "6pageAA.pdf") ' MergeFiles is the equivalent of calling OpenInputFile and CopyForm ' for each PDF in the attray. intMergeFiles = oTK.MergeFiles(arrayFiles) If intMergeFiles <> 1 Then ErrorHandler "MergeFiles", intMergeFiles End If ' Close the new file to complete PDF creation oTK.CloseOutputFile ' Release Object Set oTK = Nothing ' Process Complete Wscript.Echo("Done!") ' Error Handling Sub ErrorHandler(method, outputCode) Wscript.Echo("Error in " & method & ": " & outputCode) End Sub