[texhax] Embedding java applets in pdf output files

Jeremy jeremy at acjlaw.net
Wed Feb 23 23:09:56 CET 2011


On Wednesday, February 23, 2011, Petro Galushka wrote:
> A few years ago in this forum there was already a discussion about
> embedding java applets into pdf files generated by pdflatex. Is it
> something that can be done these days? Jar files seem to include java
> scripts in binary form, and I'm not sure if they are consistent with
> javascripts in Adobe pdfs.
> 
> More specifically, I'd like to embed LiveGraphics3D applet (live.jar) with
> a particular 3D graph (test.m) into a beamer presentation.
> 
> The code for embedding the applet into a webpage is the following. My hope
> was that there should be something similar to put it inside a pdf.
> <HTML>
> <APPLET ARCHIVE="live.jar" CODE="Live.class" WIDTH=150 HEIGHT=150
> ALIGN=LEFT>
> <PARAM NAME="INPUT_FILE" VALUE="test.m">
> </APPLET>
> </HTML>
> 
> Best,
> Petro Galushka
> 
> 
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> 
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org


AFAIK, acrobat uses interpreted javascript. 
See, e.g., Adobe's javascript guides:

js_api_reference.pdf  
js_developer_guide.pdf  
pdfmarkReference_v9.pdf

In addition, certain classes of functions are restricted to Acrobat Pro, 
so that it's only possible to distill a ps file to a fully functional  pdf with 
Acrobat Pro. If the pdf is created with pdflatex, Acrobat will not execute 
those restricted functions. The homepage for the latex package Acrotex has 
more information on choice of latex engine and distilling postscript with 
Acrobat.

Quote from js_api_reference, pg35:

When developing a JavaScript solution, you must have a minimal Acrobat (or 
Adobe Reader) version in mind. The choice of target application determines, by 
the table above, the version of JavaScript you should use.
Most JavaScript API function are documented in all versions of Acrobat and 
Adobe Reader, while others are only defined in later versions. Still, some APIs 
are restricted to Acrobat Professional and some cannot be used by Adobe 
Reader, while others can be used in Adobe Reader only when the document has 
the appropriate Reader Extension Rights. Again, for a JavaScript solution, all 
these factors must be considered.


More information about the texhax mailing list