PDA

View Full Version : Quick question on printing



JimmyMac
03-23-2006, 08:41 PM
:( Having trouble getting graphics to print.( in both FF1.07 and IE6 )

I used the pie.js script from:
http://www.dynamicdrive.com/dynamicindex11/piegraph.htm

Am I missing something or doing something wrong.

ps I did try jg.setPrintable(true)

Thanks

jscheuer1
03-24-2006, 04:17 AM
PLEASE: Include the URL to your problematic webpage that you want help with.

jscheuer1
03-24-2006, 04:34 AM
I just did a little experimentation and the printing can be enabled by finding this line in wz_jsgraphics.js:


this.setPrintable(false);

and changing it to true. However, this makes the page look horrible in IE6. No problem in FF. Perhaps there is an update on the author's site. You could have a link to an identical page that simply uses a version of wz_jsgraphics.js with that set as true, explain that it is the printable version and that it will look strange in some browsers but print fine (even with the messed up screen, the print preview looked fine in IE).

jscheuer1
03-24-2006, 04:25 PM
For IE, I just discovered that this will work:


<link rel="alternate" media="print" href="pieprint.htm">

Placed in the head, it can reference the alternate version that looks bad onscreen but prints well. That way IE can have the good looking version online but, when it comes time to print, get the version that works. Opera will print either version well. It only remains how to get the FF people over to the printer friendly version. There could be a link to the printer version that only shows in FF:


<script type="text/javascript">
if (!(document.all)&&!(window.opera))
document.write('<a href="pieprint.htm">Printer Friendly Version</a>')
</script>

jscheuer1
03-24-2006, 05:31 PM
You can still try my above suggestion, it:


<link rel="alternate" media="print" href="pieprint.htm">

may work live but, it doesn't work locally. Here is an alternative scriptlet:


<script type="text/javascript">
if (!window.opera)
document.write('<a href="pieprint.htm" target="_blank">Printer Friendly Version</a><br>')
</script>

JimmyMac
03-24-2006, 07:11 PM
jscheuer1

Thanks for the info, I got it working by changing the setPrintable in wz_jsgraphics.js.

I was trying to do it from pie.js.

I'll also look at your other suggestion.

Thanks again.

jscheuer1
03-24-2006, 10:28 PM
Well if the <link alternate= thing won't work, here is a good way to do it -

On your pie page have this script above all of the code for the pie chart:


<script type="text/javascript">
doprint=false
if (!window.opera&&this.location.search.indexOf('doprint')==-1)
document.write('<a href="pie.htm?doprint=true" target="_blank">Click for Printer Friendly Version</a><br>')
if (this.location.search.indexOf('doprint')>-1)
doprint=true
</script>

where pie.htm is the name of the page with your pie chart on it and then in wz_jsgraphics.js change:


this.setPrintable(true);

to:


this.setPrintable(doprint);

That way you will not need any extra pages or script files.