[texworks] SCRIPTING: get current poppler page number
Paul A Norman
paul.a.norman at gmail.com
Wed Oct 20 22:47:30 CEST 2010
My absolute appologies for that Reinhard.
I'll stcik to this thread now, it was split by my hand!
Ok I knew I'd have to use the Tw OS checking, however I am not sure
how Windows7 reports itself to Tw Api.
Perhaps this functinoality would be useful enough for me to try and keep on it?
"Try" becasue from what has been written it looks like pdfopen exists
with differing available switches in the differing *TeX distos
The one that comes with MiKTeX under Windows is quite limiited
compared to what Mac OSX is showing you.
I did find that it was necessary under Xp at least to pass a full path
and under the MikTex release use --open= as a switch (as per help
Continued calls for different page numbers do recycle the existing
document if acroread has it open already, under Xp it still takes a
Yes I have been finding it easier to experiment from the command line first.
Xp undrr MiKTeX---
Usage: pdfopen [OPTION...]
--file=FILE Open FILE.
--page=N Go to the N-th page.
--goto=NAMEDEST Go to the specified named destination within the
-V, --version Print version information and exit.
-?, --help Show this help message
--usage Display brief usage message
Usage: pdfopen [-V?] [--file=FILE] [--page=N] [--goto=NAMEDEST]
[-V|--version] [-?|--help] [--usage]
So I am fascinated by all those extra switcehs under Mac.
On 21 October 2010 06:29, Bruno Voisin <bvoisin at me.com> wrote:
> Le 20 oct. 2010 à 14:47, Paul A Norman a écrit :
>> Here is a simplistic scripting implementation of a suggestion by Bruno
>> to look at using pdfopen. Could use pdfclose if that is needed as
> Credit to whom credit is due: this was Reinhard's suggestion, not mine (I was not even aware of the existence of pdfopen and pdfclose in TeX Live beforehand).
> That said, on Mac OS X pdfopen does not work. Typing "pdfopen somefile.pdf" in Terminal launches X11 then yields
> pdfopen: acroread startup failed
> This message is because there is no acroread executable in the path. The executable part of Acrobat lives with the Acrobat .app application bundle and depends where this bundle is placed. For Acrobat Pro 9, the default location is
> /Applications/Adobe Acrobat 9 Pro/Adobe Acrobat Pro.app/Contents/MacOS/AdobeAcrobat
> Now, to make this work as a binary launched from Terminal you need to turn it into a script, for example
> open -a '/Applications/Adobe Acrobat 9 Pro/Adobe Acrobat Pro.app/Contents/MacOS/AdobeAcrobat' "$1"
> Calling this script acroread, making it executable ("chmod a+x acroread") and putting it in the path (for example "sudo cp acroread /usr/local/bin/") works, in the sense that you can just type in "acroread somefile.pdf" in Terminal and the file is opened in Acrobat.
> However, that still doesn't appease pdfopen which returns
> $ pdfopen somefile.pdf
> $ open: invalid option -- o
> Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
> Help: Open opens files from a shell.
> By default, opens each file using the default application for that file.
> If the file is in the form of a URL, the file will be opened as a URL.
> So it seems that pdfopen assumes an acroread that (1) opens up in X11 and (2) accepts the options (inclusing -o) that acroread has on Linux.
More information about the texworks