Example code is for an older version of Toolkit, newer code is available.
# Copyright (c) 2021 ActivePDF, Inc.
# ActivePDF Toolkit 2017
# Example generated 02/26/21
require 'win32ole'
# Get current path
strPath = File.expand_path(File.dirname(__FILE__)) + "\\"
# Instantiate Object
oTK = WIN32OLE.new("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
intLinearizeFile = oTK.LinearizeFile(strPath + 'PDF.pdf', strPath + 'new.pdf', '')
if intLinearizeFile < 0
puts "Error in LinearizeFile: #{intLinearizeFile}"
end
end
# Release Object
oTK = ''
# Process Complete
puts "Done!"