[OS X TeX] Number of pages with AppleScript in TeXShop

Maarten Sneep maarten.sneep at xs4all.nl
Tue Oct 18 15:28:59 EDT 2005


On 18 Oct 2005, at 19:23, Simon Spiegel wrote:

> a question for the AppleScript experts: Is it possible to get the  
> number of pages of a pdf document created by TeXShop with AppleScript?

None of the popular viewers have a proper applescript dictionary,  
TeXShop obviously has, but apparently it doesn't offer this info.

I think there is a pdfinfo like tool, but I didn't find it. Dirty  
trickery ahead: use lastpage.sty, write the number of the last page  
to the log file and grep from there. It does give you the TeX page  
number, not the physical page number, I don't know what you want to  
do exactly, but it may help. (parsing the logfile itself, is pretty  
hard, the page indicators may be split over multiple lines).

Alternatively: use gs to expand each page to a low-res bitmapped  
format in a temp directory, and count files.

Maarten
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list