Reverse order printing from OS X

pajdzn

Well-known member
Does anyone have a solution to print a pdf document in reverse order? It used to be so simple but now the printer have changed in the latest Mac OS X's and the function doesn't work anymore. I need to create a ps file or pdf that has the pages in reverse order for a flip book.

Any help would be greatly appreciated.
 
Still running 10.6.6 and do have the "Reverse pages" option to print with Acrobat X. But as a workaround, you can try the following script which will prompt you to choose a PDF file and will place every page of it into InDesign in reverse order. Just tried it with a 16 pages PDF and it seems to work. Just paste the following code in AppleScript Editor, compile then run:

--Script by Colorblind, tested with Acrobat 10 and InDesign CS5

tell application "Finder"
activate
set mypdf to choose file with prompt "Choose the PDF you want to place in InDesign" as string
open file mypdf using application file id "CARO"
tell application "Adobe Acrobat Pro"
activate
set b to get crop box of page 1 of active doc
set w1 to item 3 of b as integer
set w0 to item 1 of b as integer
set h1 to item 2 of b as integer
set h0 to item 4 of b as integer
set PDFheight to (h1 - h0) / 72
set PDFwidth to (w1 - w0) / 72
set pagecount to count every page of active doc
set idh to PDFheight & " i" as string
set idw to PDFwidth & " i" as string
close active doc without saving
end tell


set idpage to 1
set pdfpage to 1

tell application "Adobe InDesign CS5"
activate
set mydoc to make document
tell document preferences of mydoc
set facing pages to false
set page width to idw
set page height to idh
set pages per document to pagecount

end tell
repeat pagecount times
set page number of PDF place preferences to pagecount

-- the "crop PDF" parameter can be changed to the following: crop content/crop art/
--crop PDF/crop trim/crop bleed/crop media/crop content/crop art/¬
--crop PDF / crop trim / crop bleed / crop media

set PDF crop of PDF place preferences to crop PDF

set mypdfpage to place mypdf on page idpage of mydoc
set idpage to idpage + 1
set pagecount to pagecount - 1
end repeat
end tell
end tell
 
Did you try putting page selection in reverse order in the print dialogue box? Ex- Print From: Page 455 To: Page 1 . I seem to remember trying that once on a goof and it worked.
 
Hi Colorblind,

As a goof I wanted to run your script with CS4 Acrobat 9 Pro 9.4.4 and CS4 ID4 6.0.6 and got the following Applescript Error: The variable b is not defined. I'm still using 10.5.8 PPC if that makes a difference. y the way did I mention I don't know Applescript but wanted to give it a try. I did compile it and everything came up fine and I changed the Application in the script to Adobe InDesign CS4 which it recognized.
Thanks for your time.
 
Hi Colorblind,

As a goof I wanted to run your script with CS4 Acrobat 9 Pro 9.4.4 and CS4 ID4 6.0.6 and got the following Applescript Error: The variable b is not defined. I'm still using 10.5.8 PPC if that makes a difference. y the way did I mention I don't know Applescript but wanted to give it a try. I did compile it and everything came up fine and I changed the Application in the script to Adobe InDesign CS4 which it recognized.
Thanks for your time.

Open a PDF in Acrobat, paste the following code in AppleScript Editor and make sure the "Event Log" tab is enabled at the bottom of the AppleScript Editor. Then compile and run:

tell application "Adobe Acrobat Pro"
activate
tell PDF Window 1 to get page number
set displayed_page to the result
set b to get crop box of page displayed_page of active doc
end tell


You should get something like this in the "Event Log" window of the AppleScript Editor:

tell application "Adobe Acrobat Pro"
activate
get page number of PDF Window 1
--> 1
get crop box of page 1 of active doc
--> {0.0, 792.0, 612.0, 0.0}
end tell
Result:
{0.0, 792.0, 612.0, 0.0}
 
Last edited:
Thanks Colorblind I finally got it to work. Although I had Acrobat Pro activated for what ever reason it kept launching Acrobat Reader. I believe the script kept looking for Pro but some how kept seeing Reader. Just curious but I see that new line of "code" in the original script, any idea why it won't work and is there a way to combine both codes/scripts into one? Thanks for your time and if you're busy no big deal I can still print in reverse with the older printer that I am using. I just find it interesting and I would like to get into scripting one day.
 
Rewrote the code in a neater way, let me know if it works (it does here on the 2 macs I have):

--Script by Colorblind, tested with Acrobat X and InDesign CS5

tell application "Finder" to set mypdf to choose file with prompt "Choose the PDF you want to place in InDesign" as string
tell application "Adobe Acrobat Pro"
activate
open mypdf
tell PDF Window 1 to get page number
set displayed_page to the result
set b to get crop box of page displayed_page of active doc
set w1 to item 3 of b as integer
set w0 to item 1 of b as integer
set h1 to item 2 of b as integer
set h0 to item 4 of b as integer
set PDFheight to (h1 - h0) / 72
set PDFwidth to (w1 - w0) / 72
set pagecount to count every page of active doc
set idh to PDFheight & " i" as string
set idw to PDFwidth & " i" as string
close active doc without saving
end tell


set idpage to 1
set pdfpage to 1

tell application "Adobe InDesign CS5"
activate
set mydoc to make document
tell document preferences of mydoc
set facing pages to false
set page width to idw
set page height to idh
set pages per document to pagecount

end tell
repeat pagecount times
set page number of PDF place preferences to pagecount

-- the "crop PDF" parameter can be changed to the following: crop content/crop art/
--crop PDF/crop trim/crop bleed/crop media/crop content/crop art/¬
--crop PDF / crop trim / crop bleed / crop media

set PDF crop of PDF place preferences to crop PDF

set mypdfpage to place mypdf on page idpage of mydoc
set idpage to idpage + 1
set pagecount to pagecount - 1
end repeat
end tell
 
Yes it does indeed work. Excellent and very quick. I'm impressed. As I said earlier in case you also needed it for an older machine, it works for a PPC G5 OSX 10.5.8 and CS4 Acrobat Pro and InDesign.
Thanks again,
CruzinCooler
 
Glad it worked. Programming is 10% coding and 90% debugging :) Anyway as far as I'm concerned, AppleScript is the hidden gem of Mac OS. So many things you can automate with an easy to learn, english-like syntax programming language. Have a look at MacScripter
 
Once again thanks and MacScripter seems to be an informative site. I'll try and figure out that scripting thing sooner or later.
 
Option #2:

I've got a little script that works on both mac and pc within Acrobat. Just rename the extension to .js and dump it in the Acrobat Javascripts folder. Reverse Page Order will show up as an option under the Document menu.
 

Attachments

  • Reversepageorder.txt
    441 bytes · Views: 240
So far I've been using Quite Imposing for reverse pages or tools inside the workflow and was always wondering why the pitstop does not have it.
Colorblind's effort is appreciated but I prefer gig0's method much more, no need for indesign.
I tested it and it works as advertise, thanks for sharing great script.
 

PressWise

A 30-day Fix for Managed Chaos

As any print professional knows, printing can be managed chaos. Software that solves multiple problems and provides measurable and monetizable value has a direct impact on the bottom-line.

“We reduced order entry costs by about 40%.” Significant savings in a shop that turns about 500 jobs a month.


Learn how…….

   
Back
Top