Export a PDF to PostScript Quickly with Acrobat JavaScript
Question details
Create a quick Acrobat command that exports the current PDF as a PostScript file in a work folder.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Use a custom menu item or toolbar button to run JavaScript on the current PDF and save a related PostScript file.
- Observed behavior
- The desired command derives an output path from the current PDF and saves it in PostScript format without repeating the export workflow.
Open a PDF that has already been saved to disk and confirm that your Acrobat installation supports PostScript export. Check the Acrobat JavaScript API documentation for the installed PostScript conversion ID and the requirements for trusted functions.
Add a trusted Acrobat menu command for PostScript export
Use a folder-level JavaScript to export the active PDF to a PostScript file in the same folder.
Acrobat may restrict silent saving and conversion outside a privileged context. A folder-level trusted function provides that context, but destination restrictions and available converters depend on the Acrobat installation.
The example uses com.adobe.acrobat.ps as the conversion ID. Verify it against the Acrobat SDK and your installed converters before relying on the command.
In Acrobat's user JavaScripts folder, create a .js file and add this code: var exportCurrentToPS = app.trustedFunction(function (doc) { app.beginPriv(); try { if (!doc || !doc.path || !/\.pdf$/i.test(doc.path)) { app.alert('Open a PDF saved to disk first.'); return; } var outputPath = doc.path.replace(/\.pdf$/i, '.ps'); doc.saveAs({ cPath: outputPath, cConvID: 'com.adobe.acrobat.ps' }); } catch (e) { app.alert('PostScript export failed: ' + e); } finally { app.endPriv(); } }); app.addMenuItem({ cName: 'ExportCurrentToPS', cUser: 'Export Current PDF to PostScript', cParent: 'File', cExec: 'exportCurrentToPS(event.target);' });
Close and reopen Acrobat so it loads the folder-level script. Look for Export Current PDF to PostScript in the File menu.
Open a saved PDF, choose File > Export Current PDF to PostScript, and check the PDF's folder for a file with the same name and a .ps extension.
Edit the outputPath assignment in the .js file to point to your work folder using Acrobat's path syntax. Restart Acrobat and test the revised path and conversion ID before adding a toolbar shortcut.

Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight alternative for everyday PDF and Office work, with a familiar interface and format compatibility that makes moving existing files straightforward. It does not run or repair Acrobat JavaScript commands.

Frequently Asked Questions
Why does the script need a trusted function?
Acrobat restricts some save operations in ordinary document scripts. A folder-level app.trustedFunction can provide a privileged context for Doc.saveAs(), subject to Acrobat's security and destination restrictions.
How does the command choose the PostScript filename?
The script reads the open document's path and replaces its final .pdf extension with .ps. In the example, the output is placed in the same folder as the PDF.
What should I check if PostScript export fails?
Check the Acrobat error message, confirm that the PDF is saved locally, and verify the destination permissions and PostScript conversion ID in the Acrobat SDK for your installation.
Can I save the PostScript file to a different work folder?
Yes. Change the outputPath assignment in the folder-level script to the intended destination using Acrobat path syntax, then restart Acrobat and test the command. The folder must be permitted and writable.
Can WPS Office run this Acrobat JavaScript?
No. This command uses Acrobat-specific JavaScript APIs. WPS Office can be used separately for PDF and Office work, but it does not run or fix the Acrobat script.




