I realised that the printing was not working in firefox only. Seems to work 
fine for me with safari and ie.
Paul

----- Message d'origine -----
De: Robert Hanson <[email protected]>
Date: Lundi, Mai 11, 2009 7:38 am
Objet: [Jmol-users] Jmol applet printing
À: "[email protected]" <[email protected]>

> I was noticing that the applet is blank when printing a page. From 
> what I
> can tell, it's a serious issue for all applets, and may not have an 
> easysolution. but here's a slick way to do it in Firefox, as 
> demonstrated at
> http://chemapps.stolaf.edu/jmol/docs/examples-11/jmol-flot.htm
> 
> 
> 1) Create two divs, one for an image and one for the applet:
> 
> <div id="imagediv" class="printonly"></div>
> <div class="noprint">
> <script type="text/javascript">
> jmolInitialize(".","JmolAppletSigned0.jar")
> jmolApplet(["450","450"],....)
> </script>
> </div>
> 
> 2) Now for styles we have:
> 
> <style>
> @media print {
>    .noprint {display:none}
>    .printonly {display:block}
> }
> @media screen {
>    .noprint {display:block}
>    .printonly {display:none}
> }
> </style>
> 
> And to get the image we use a link on the page that runs this 
> JavaScriptfunction.
> 
> function setImage() {
>    document.getElementById("imagediv").innerHTML = '<img
> src="data:image/jpeg;base64,'+jmolGetPropertyAsString("image")+'" />'
> }
> 
> Now when the page is printed, the image is created and displayed, 
> and the
> applet is hidden. It appears that the applet has printed.
> 
> By the way, that base64 image business is broken in Jmol 11.7 -- 
> only fixed
> in the next release, 11.7.35.
> Works like a charm, but only for Firefox, not Opera or MSIE.
> 
> Bob
> 
> 
> 
> 
> -- 
> Robert M. Hanson
> Professor of Chemistry
> St. Olaf College
> 1520 St. Olaf Ave.
> Northfield, MN 55057
> http://www.stolaf.edu/people/hansonr
> phone: 507-786-3107
> 
> 
> If nature does not answer first what we want,
> it is better to take what answer we get.
> 
> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
> 

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to