views:

90

answers:

5

I want to open a PDF document at a specific page from the command line, sort of like vim +n [file]. Is there any way to do that in OSX, with any PDF reader program?

+1  A: 

No. Command line switches are specific to each program.

Daniel A. White
+1  A: 

Maybe this will help you: http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf

I found an arg page=pagenum on page 5 in this pdf that might be useful! I haven't tested it though!

EDIT:

I just tested it on Windows (unfortunately I don't have Linux) and it works. On windows it's:

<path to Acrobat Reader.exe> /A "page=2" somePDFFile.pdf

I guess it's something similar in Linux or OSX.

Alex
+2  A: 

You can do this with Evince using the -p or --page-label=PAGE command line argument like so:

evince -p 5 foo.pdf
ezod
A: 
open -a Preview someFile.pdf
Swingley
How can he open the PDF at a specific page, though?
Jeff
A: 

The following method works with Skim, an open-source replacement for Preview.app. First, download Skim, then save the following code on a text file and name it "gotopage.scpt":

on run argv
    tell application "Skim"
        activate
        open (item 1 of argv)

        tell document 1
            go to page index (item 2 of argv)
        end tell

    end tell
end run

You can now tell Skim to open a certain PDF and go to page 99 by writing this on the terminal:

osascript gotopage.scpt "/full/path/to/doc/mydoc.pdf" 99

You might want to wrap the above line into an sh script of your own. Also note that the path to the PDF must be absolute, otherwise Skim won't find the file.

Julio Gorgé