[texworks] SCRIPTING: get current poppler page number
Bruno Voisin
bvoisin at me.com
Thu Oct 21 14:39:34 CEST 2010
Le 21 oct. 2010 à 12:39, Paul A Norman a écrit :
> Downloaded the Acrobat API
>
> Found this reference for the Apple Event called open
>
> We may not need the /A I'm not sure.
>
> Paul
> ...
> open
> Opens a document or documents.
> Syntax
> open [list of alias] invisible [boolean] options [string]Parameters
>
> open The document or documents to open.
> invisible Whether the opened document should be hidden. Default is false.
> options Optional parameter string of open actions.
The "options" keyword seems to be the key indeed, together with the ordering of the keywords. The following does work
#!/bin/bash
PATH="$PATH:/usr/texbin:/usr/local/bin"
name=$(basename "$1" .pdf)
basefname="`pwd`/${name}"
/usr/bin/osascript << END
tell application "Adobe Acrobat Pro"
activate
open POSIX file "$basefname.pdf" options "page=3"
end tell
END
but it does return "missing value" on the command line (even though the PDF file is indeed opened in Acrobat at the correct page).
That said, I tried to find the API you're mentioning but found only the SDKs from <http://www.adobe.com/devnet/acrobat/sdk/eula.html>. There, the Mac SDK does not use Unix-style scripts, it goes AppleScript all the way. There's for example a script PrintPage.applescript which upon execution displays a dialog for choosing a PDF file then prints the first page of this file to the current printer (I imagine the SDK prohibits copying the code here).
But in any case, I'm really out of my league here and will stop, to let more experienced Mac users take over.
Bruno
More information about the texworks
mailing list