' Copyright (c) 2021 ActivePDF, Inc. ' ActivePDF Toolkit 2018 ' Example generated 04/20/21 Dim FSO, strPath, lngLinearized, intLinearizeFile ' Get current path Set FSO = CreateObject("Scripting.FileSystemObject") strPath = FSO.GetFile(Wscript.ScriptFullName).ParentFolder & "\" Set FSO = Nothing ' Instantiate Object Set oTK = CreateObject("APToolkit.Object") ' Check to see if the PDF is already linearized lngLinearized = oTK.IsFileLinearized(strPath & "PDF.pdf") ' If not, then linearize the file If lngLinearized = false Then intLinearizeFile = oTK.LinearizeFile(strPath & "PDF.pdf", strPath & "new.pdf", "") If intLinearizeFile < 0 Then ErrorHandler "LinearizeFile", intLinearizeFile End If End If ' Release Object Set oTK = Nothing ' Process Complete Wscript.Echo("Done!") ' Error Handling Sub ErrorHandler(method, outputCode) Wscript.Echo("Error in " & method & ": " & outputCode) End Sub