Example code is for an older version of Toolkit, newer code is available.
' Copyright (c) 2019 ActivePDF, Inc.
' ActivePDF Toolkit 2017
' Example generated 12/15/19
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