Skip to main content
filippk16315418
Participant
February 11, 2019
Question

Programatically optimize scanned files?

  • February 11, 2019
  • 2 replies
  • 650 views

I have a VBScript file that iterates through a designated folder. My end goal is to check for files over 25MB and use Acrobat 9's "Optimize scanned file" feature to make them smaller.

Unfortunately, I do not know the command or function within Acrobat's API in order to make this happen. What commands can I use to automate the process of optimizing scanned files?

This is a VBScript file running on a local computer with Acrobat 9 installed. I have tried looking through Acrobat 9's API documentation but cannot seem to find an answer.

My code so far:

Const PDF_FOLDER = "Z:\ARM\temp\"  
Set gAcro = CreateObject("AcroExch.App")
Set newPD = CreateObject("AcroExch.PDDoc")
Set newAV = CreateObject("AcroExch.AVDoc") 
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(PDF_FOLDER).Files 
For Each fileObj In oFolder
     If fileObj.size/1000000 > 25 Then
          newAV
.Open PDF_FOLDER & fileObj.Name, fileObj.Name
          '//INSERT COMMAND FOR "OPTIMIZE SCANNED FILE"
          newAV
.Close(1)
     End If
Next

Ideally, this will optimize the scanned file, save it to overwrite the current one, close, and continue iteration. all help would be appreciated in filling the comment section in the if statement.

This topic has been closed for replies.

2 replies

Legend
April 3, 2019

Though, I don't believe there is any such method.

Bernd Alheit
Community Expert
Community Expert
February 12, 2019

Try the forum for Acrobat SDK.