printout from website

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible (if yes, how to do that?). I want to put on my website a
button. If you click the button the printing of the website will start on
your local printer.
I know, you can print that from Internet Explorer menu bar but I want to do
that by clicking my own button on my own website
 
thx man!

is it possible to show a preview as well? Anyway, that is not important...
ok, I put a button on website. print() method works fine, but on the
printout there is also the button. Any ideas how to remove that?





Eliyahu Goldin said:
Sure. A javascript call print() will do:

<input type="button" value="Print" onclick="window.print()" />

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Chris said:
Is it possible (if yes, how to do that?). I want to put on my website a
button. If you click the button the printing of the website will start on
your local printer.
I know, you can print that from Internet Explorer menu bar but I want to
do
that by clicking my own button on my own website
 
No, you are limited to whatever your browser's print dialog provides.

To remove the button for printing, handle the onbeforeprinting and
onafterprinting events. You can set them in the <body> tag. You will need to
add an id to the button and hide the button in the onbeforeprinting as
myForm.myButton.style.visibility="hidden" and show it in the onafterprinting
event as myForm.myButton.style.visibility="visible".

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Chris said:
thx man!

is it possible to show a preview as well? Anyway, that is not
important...
ok, I put a button on website. print() method works fine, but on the
printout there is also the button. Any ideas how to remove that?





Eliyahu Goldin said:
Sure. A javascript call print() will do:

<input type="button" value="Print" onclick="window.print()" />

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Chris said:
Is it possible (if yes, how to do that?). I want to put on my website a
button. If you click the button the printing of the website will start
on
your local printer.
I know, you can print that from Internet Explorer menu bar but I want
to
do
that by clicking my own button on my own website
 
Thx again. That works :)

Last question: at the bottom of the printout There are date and path to the
source file of the website. Is it possible to reformat the date and delete
the path or change it to my own text?
 
is it possible to show a preview as well? Anyway, that is not important...
ok, I put a button on website. print() method works fine, but on the
printout there is also the button. Any ideas how to remove that?

Another solution is to have separate screen and print stylesheets
using the media="" attribute in the stylesheet links. Not only can
you remove the button by applying the "display:none;" attribute to its
class but you can reformat other elements on the page based on their
classes to produce a much more elegant printout.
 
Back
Top