• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Programatically optimize scanned files with VBS

New Here ,
Feb 14, 2019 Feb 14, 2019

Copy link to clipboard

Copied

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.

TOPICS
Acrobat SDK and JavaScript

Views

907

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Feb 24, 2019 Feb 24, 2019

You can kick off the feature as if the user choose it from the menu using “executeMenuItem” – but that will just bring up the UI and you will need to then manually click through it. If that works – have at it!

Votes

Translate

Translate
Adobe Employee ,
Feb 15, 2019 Feb 15, 2019

Copy link to clipboard

Copied

Acrobat 9 has been out of support for at least 3-5 years now.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 15, 2019 Feb 15, 2019

Copy link to clipboard

Copied

I'm aware; but I don't think that really helps me here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 15, 2019 Feb 15, 2019

Copy link to clipboard

Copied

What makes you think there is a way to do this? Never seen it in the documentation of any version. (To be honest the API changes little).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

Im pretty sure the API includes a way to access features in the Acrobat application ribbon and to check that they exist,

so it seems, given that "Optimize scanned files" is a feature in the toolbar, that there should be some way to interact with it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 24, 2019 Feb 24, 2019

Copy link to clipboard

Copied

LATEST

You can kick off the feature as if the user choose it from the menu using “executeMenuItem” – but that will just bring up the UI and you will need to then manually click through it. If that works – have at it!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

Pretty sure is good. When you find the API please let us know.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines