You need to sign in to do that
Don't have an account?
CSS files in Javascript
Hi all,
I've been experimenting with ways to print part of a page layout by using an Onclick Javascript custom button. I've got it to print the div I want using the following code;
var prtContent = document.getElementById("ep");
var WinPrint = window.open('', '', 'left=0,top=0,width=1024,height=768,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
It prints the right bit, but obviously it doesn't pick up the necessary CSS to make it half-way decent. I've tried to make it pick up the CSS by using various combinations of;
WinPrint.document.write('<link rel=stylesheet href=common.css>')
WinPrint.document.write('<link rel=stylesheet href=extended.css>')
Variations include just using one or other line, and other including the /sCC/40.0/. . . etc. etc. full links.
The problem that I have when using these is that nothing appears on the printed document at all :) Anyone got any ideas? I'd like to make this work instead of going down the Visualforce rendertoPDF route, to be honest, in case people think of that :)
thanks
Richard