1
votes

I'm trying to convert some PDF files to PDF/X-1A format. I've created an action in Acrobat to do this, and I would like to call this from NodeJS whenever a new PDF file is created with my current process. Then I want to serve the converted file back to the user. There doesn't seem to be any other solutions out there to convert/compress PDFs in the way that Acrobat Pro does, so this is why I am pursuing this option.

My process is basically as follows:

genPdf:function(content,cb){
    // Config for PDF generation, etc
    // ...

    pdfGenerator.doConversion(config, pdfPath, function(result) {
        // After file is generated, I want to call my adobe action
        var cmd = 'call_adobe_acrobat_action_cmd';

        exec(cmd, function(error, stdout, stderr) {
          // After action is called I'll initiate a watch on the directory that the action will write the converted file to
          // When conversion has completed, I will serve the converted file back to the user
        });
    }
}
2

2 Answers

2
votes

It's actually a violation of the Acrobat license agreement to use it in that fashion. Acrobat Actions can process multiple files but the Action needs to be triggered by a user.

Check out pdfToolbox Server for server-side automated conversion from PDF to PDF/X.

2
votes

The Acrobat plugin AutoBatch will allow you to create a .bat file which will launch Acrobat and run a given "action" you have defined in Acrobat.

Note that AutoBatch is not free.

The batch files created by AutoBatch actually just set some environment variables, which are presumably picked up by the Acrobat plugin, which in turn triggers your action.

Example .bat file produced by AutoBatch:

SET AUTOBATCHSEQU=C:\Users\IEUser\AppData\Roaming\Adobe\Acrobat\10.0\Sequences\myaction.sequ
SET AUTOBATCHFINAL=0
SET AUTOBATCHDEST=
SET AUTOBATCHALTPATH=%1
SET AUTOBATCHALTOUTPUTPATH=%2
SET AUTOBATCHNOPROGRESS=no
SET AUTOBATCHFILEEXT=
SET AUTOBATCHNOSUBFOLDERS=no
"C:\Program Files\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe" /n /h