[texworks] SCRIPTING: get currnet poppler page number
st.loeffler at gmail.com
Thu Nov 4 20:44:21 CET 2010
I have to amend my previous answer...
Am 2010-10-18 13:22, schrieb Paul A Norman:
> Can TwScript tell me which page
> poppler is on in the current document please?
No, not directly. But with a workaround ;).
Basically, you can access the status bar, and via some tricks the text
that tells the user the current page. The problems are (without any
claim at completeness):
1) This is locale-dependent (this should be handled by the script below,
as long as there are exactly two numbers and the current page is the
2) This depends on the current layout of the status bar (as the widgets
are unnamed); so if that layout changes the script breaks
And here's the script snippet:
// Context: PDFDocument
var str = TW.target.findChild("statusbar").findChildren().text;
var m = str.match(/\D*(\d+)\D+(\d+)/)
var n = Math.min(RegExp.$1, RegExp.$2);
More information about the texworks