Forum How do I...?

Prince 7.0 Javascript Support

TristanS
Hi -
I was checking out the roadmap, and it seems as though Prince supports the prince-pdf-script tag, yet doesn't support javascript.
In simple tests, I tried to apply basic javascript ('document.print("test");") with this attribute to no avail. This would seem to indicate that javascript is not yet supported.
If that is the case, does prince-pdf-script actually send javascript to the user's PDF reader to execute?

Thanks for any info/updates on javascript support.
mikeday
Prince embeds the specified JavaScript in the PDF file and it should be executed when the PDF file is opened in Acrobat. Other non-Adobe PDF viewers like xpdf may not support JavaScript execution. You can also use "prince-pdf-open-action: print".
mikeday
Also I think the correct JavaScript for printing in this context is this.print(), not document.print().
TristanS
Thanks for the quick reply - I actually brainfarted with that JS example. Was going for "document.write('test');" in an attempt to get prince to do any JS processing on its own.
Looking forward to when Prince gets a JS engine!
mikeday
We'll get there in the end. :)

Just out of interest, what kind of JavaScript processing would you like to do with your documents?
StoneCypher
Well I don't know what he wants to do, but I'd like to do a lot of stuff with JavaScript that CSS cannot do. Examples include automatic TOC extraction, line numbering, zebra and deep zebra striping, et cetera.

John Haugeland is http://fullof.bs/