Skip to main content
sensus_2486
Participant
February 26, 2026
Question

Compress large PDF to smaller using Adobe Acrobat Pro programatically...

  • February 26, 2026
  • 1 reply
  • 35 views

I have an application that generates large PDF files which I need to compress using Adobe Acrobat Pro. Although I can reduce the file size using the “Reduced Size PDF” or “Optimized PDF” options, the process currently requires manual intervention.

I want to automate this workflow so that I can supply an input file name and have the PDF automatically compressed and saved to a specified destination.

I also tried using Guided Actions, but it still involves manual steps and does not provide full automation.

My questions are:

  • Is it possible to fully automate PDF compression in Adobe Acrobat Pro so it can be controlled programmatically (for example, using JavaScript)?

  • Can trustedFunction be used for this purpose?

  • Are there any sample code examples available?

    1 reply

    AnandSri
    Legend
    February 27, 2026

    Hello ​@sensus_2486 

     

    I hope you are doing well, and thank you for reaching out.

     

    The full programmatic automation of PDF compression using Acrobat JavaScript (including trustedFunction) is not yet supported. You cannot directly call Reduce File Size or PDF Optimizer through Acrobat JavaScript.

     

    Fully automate via Acrobat Pro JavaScript (like a headless API)? Not as a supported approach; Acrobat JS is sandboxed and Optimizer is not documented as a callable JS API.

    Can trustedFunction do it? It can enable certain privileged JS operations in trusted contexts, but it doesn’t turn PDF Optimizer into a supported programmatic command.

     

    For sample codes, please see these articles: 

    https://opensource.adobe.com/dc-acrobat-sdk-docs/

    https://www.adobe.com/devnet-docs/acrobatetk/tools/AppSec/javascript.html?highlight=menu

     

    Regards,

    Anand Sri.