function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TechSteveTechSteve 

just want to print my vf page

I have a nuber of custom forms I need to print what you see on screen. But, if I print from my browser I only get half the width of the page and only a short piece of it not the full page (they are scrolling pages). When I try java script they all call the browser print so I get the same result.

Can anyone help with any ideas.

Tried renderAs PDF page but it is just a mess.

I have tried the following:

<script Language="Javascript">

function printit(){  
if (window.print) {
    window.print();  
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
}
}
</script>

<script Language="Javascript">  
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
    document.write('<form><input type=button value="Print this Page" name="Print" onClick="printit()"></form>');        
}
</script>

Short alternative.........

<SCRIPT LANGUAGE="JavaScript">
if (window.print) {
document.write('<form><input type=button name=print value="Print" onClick="window.print()"></form>');
}
</script>

Shorter alternative .........

<a href="javascript&colon;window.print()">Print this page</a>

Andy BoettcherAndy Boettcher

Please don't take offense to my statement (I'm driving toward helping you), but the problem could be more of how you have your VF page structured than the printing component.

 

Any chance you can post your VF code?  There may be something that we can help you streamline perhaps?

 

I don't claim to be "the expert" - I could be totally wrong on my thought above too.  If it is truly just that complicated of a page, one idea I have had to pursue in the past is to have an alternate "print" stylesheet that will make my page more "printer-friendly".

 

Thoughts?

 

-Andy