Link to home
Start Free TrialLog in
Avatar of Rick_Penney
Rick_Penney

asked on

Omit header, footer & radio buttons when using window.print

Hi, I need to make sure our users always have the latest copy of a .pdf file from our Intranet, so initially I wanted to see if there was a way to prevent the PDF from being saved to the desktop. As this doesn't appear to be possible my next approach is to put the contents of the .pdf into a .html file and use the javascript:popUp command.
This works, however both the Print and Close buttons appear on the printed page along with the header and footer text, all of which I want to remove.
Kind regards,
Rick Penney
javascript-code.txt
Avatar of Dorababu M
Dorababu M
Flag of India image

How about hiding the button onclick and then calling your print function?
ASKER CERTIFIED SOLUTION
Avatar of M. Tariq
M. Tariq
Flag of Oman image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rick_Penney
Rick_Penney

ASKER

Thank you both for your quick replies

M. Tariq
whereabouts in the code would I enter this?
Would this also stop the Print and Close buttons from printing?

Dorababu M
Do you mean to remove the buttons and just use File, Print or Ctrl P to bring up the Printer selection box?

Kind regards
Rick
whereabouts in the code would I enter this?
anyplace on your page, preferably at the beginning, just wrap your css rules with <style></style> tag.
Would this also stop the Print and Close buttons from printing?
Yes, you can hide whatever you want within the css rules.
Actually it is fully depends on the rules you gonna define.
OK great, thank you. I'm out of the office now until tomorrow so will report back then
regards
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Many thanks to you both for your time
I used a combination of both information, I also added the following below as well.
I didn't really achieve what I was after completely, as I wanted to prevent the Header and Footer text that the browser puts in , e.g the Url in the Footer but I have since learned that this is controlled in the Users Browser and isn't influenced by the CSS.
kind regards,
Rick

<button id="printPageButton" onClick="window.print();">Print</button>

 #printPageButton {
    display: none;