PDF Automation Station

PDF Automation Station

JavaScript: Reverse Loops

Reversing the loop can make the script easier and avoid errors

David Dagley's avatar
David Dagley
Aug 31, 2024
∙ Paid
Share
spiral concrete staircase
Photo by Tine Ivanič on Unsplash

Get the course above, and a suite of automation tools for FREE with a Professional subscription.


JavaScript Loops

JavaScript loops are very handy for repeating scripts, counting things, and automating processes. They can be executed easily from the JavaScript console in Acrobat Pro. The variable in a loop is incremented (or decremented) to determine how many iterations should be performed. Here’s a simple loop that can be run from the console to return the numbers 1 through 10:

for(var i=1;i<11;i++)
{
console.println(i);
}

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 David Dagley
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture