Skip navigation
ShinyDawn999
Currently Being Moderated

Editing a preset acrobat action(.sequ file)

Sep 6, 2012 1:43 PM

Hello! I recently downloaded the "add a blank page to the end of the document if the page count is odd" action for acrobat and now i need to add to it an instruction that rotates to 180 degrees every second page only if it and the one before are landscape, if they are both portrait or of different orientations, they should be left alone. Optionally, if the document contains x landscape pages followed by y portrait pages and x is odd, then a blank page should be added between the x landscape and the y portrait pages. But thats optionally..

 

Now i've been told i have to learn JavaScript for this. Im asking if there is a simpler, more accessible way to do it. If not, exactly what program should i get and maybe what book to look for?

 
Replies
  • Currently Being Moderated
    Sep 7, 2012 12:55 AM   in reply to ShinyDawn999

    You can't edit a .SEQ file directly (unless you can read the raw code) - you should import it, edit the action with Acrobat then re-export it.

     

    Actions don't have any logic so you cannot do what you want with the inbuilt steps. It's only possible with JavaScript - you don't need extra software (beyond Acrobat) but if you've never written a JS program it's not a trivial thing to work out.

     

    Someone might reply with a working code sample, but the general logic would be:

     

    • Loop through each page and find the rotation using the getPageRotation() function. Also get the page dimensions using getPageBox() as the page may be 'true' landscape or it may be a portrait page with a 90-degree rotation applied.
    • Go through the array of values and find the ones which need to be turned. Rotate them using setPageRotations().
    • Count the pages of each type and use newPage() to insert your blank page in the right place.

     

    To run this against a whole bunch of documents you'd create a new Action, use the "JavaScript" step, put in the code and save it. Note that the JS step cannot tell the Action if the file has been changed or not, so every file you process will have to be re-saved.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 7, 2012 6:19 AM   in reply to ShinyDawn999

    On the overview page for this forum ( http://forums.adobe.com/community/acrobat/acrobat_scripting?view=overv iew ) there's a Getting Started box which has links to some tutorials and the Acrobat JS API reference documentation.

     
    |
    Mark as:
  • George Johnson
    9,232 posts
    Aug 11, 2002
    Currently Being Moderated
    Sep 7, 2012 4:55 PM   in reply to ShinyDawn999

    There are very few books dedicated to JavaScript in Acrobat. An alternative is the susbscription site PDFScripting.com

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 8, 2012 8:21 AM   in reply to ShinyDawn999

    First, there is the Java language and the script JavaScript and they are very different items.

     

    There are a number of free tutorials at Acrobat Users Community and most of the JavaScript tutorials are written by Thom Parker who runs PDFscrpting.com.

     

    The page orintation is for viewing only. And if you were to modify the program for all possible situations, you would need to look at the previous page and deterimine its rotation and then rotate your added page as needed.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 8, 2012 10:29 AM   in reply to ShinyDawn999

    Acrobat has a built-in JavaScript console and there is no development environment since this is a scripting language like BASIC and not a compiled language like C++.

     

    Thom Parker has posted a free tutorial about using the JavaScript console at Acrobat Users Community.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points