ChatGPT Prompt for Working Acrobat JavaScript
Hi all,
I am not a coder by trade but see how much value there is in writing some JavaScript code that can automate some of our Production/Pre-Flight work.
My current prompting generates code that won't execute without error.
Is there any prompting/prompt input folks could recommend to get ChatGPT to generate code that uses the Acrobat API and JavaScript that is exclusively compatible with Adobe Acrobat?
For reference, here is my current prompt:
I would like to write a script for Adobe Acrobat Professional 2022. Please use JavaScript 1.5 of ISO-16262 (formerly ECMAScript), and nothing newer or more modern. Please use detailed comments. The script should be compatible with the Execute JavaScript feature in the Action Wizard. This script should ONLY use features and function calls available in the Acrobat JavaScript API. Ensure all variables are defined at the maximum scope and accessible in all blocks and functions.
The script should set the PDF to edit mode first, as it will be making changes to the content. Then, iterate through all pages in the pdf. For each even page: if there is any content that is not whitespace (not just annotations, but any content including text, images, or otherwise) in right 0.4 inch margin, move the entire contents of the page to the left until all non-whitespace content is outside of this margin. If moving the page would cause any page content to overflow outside of the page, instead, move the content as far as possible, and then shrink the page the minimum amount necessary to ensure no non-whitespace content is in the rightmost 0.4 inch right margin. If after these actions, any non-whitespace content is over the left 0.2 inch margin, shrink the page until all content is within the 0.2 inch left margin, and 0.4 inch right margin.
A dialog box should be shown when the script starts running and let the user know that another dialog box will show upon completion. A dialog box should be shown when the script is done running.
