Mobile app version of vmapp.org
Login or Join
Murphy175

: How to display a logo in a printed web page that doesn't appear on-screen? I have sales report I want to print with a logo, but I don't want it shown on the screen. I'm currently trying

@Murphy175

Posted in: #Javascript #Php #Print

I have sales report I want to print with a logo, but I don't want it shown on the screen.

I'm currently trying to use JavaScript to print a particular DIV from a page:

<script type="text/javascript">
function PrintDiv() {
var divToPrint = document.getElementById('divToPrint');
var popupWin = window.open('', '_blank', 'width=300,height=300');
popupWin.document.open();
popupWin.document.write('<html><body onload="window.print()">' +
divToPrint.innerHTML + '</html>');
popupWin.document.close();
}
</script>
<a href="#" onclick="PrintDiv();">Print page</a>


Is this the right method I should use so that the logo is shown only in the printed sales report?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murphy175

1 Comments

Sorted by latest first Latest Oldest Best

 

@Holmes151

Use a print stylesheet to show the logo.

Leave the logo in your on-screen version of the report, just hide that div with your normal stylesheet.

In your print stylesheet, simply display the div with the logo.

Here's a short, snappy guide to using a print stylesheet: www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme