473,386 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

printout from website

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
Feb 6 '07 #1
6 1307
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" <Ch***@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.com...
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

Feb 6 '07 #2
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" wrote:
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" <Ch***@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.com...
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


Feb 6 '07 #3
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 <bodytag. 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" <Ch***@discussions.microsoft.comwrote in message
news:CB**********************************@microsof t.com...
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" wrote:
>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" <Ch***@discussions.microsoft.comwrote in message
news:4C**********************************@microso ft.com...
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



Feb 6 '07 #4
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?
Feb 6 '07 #5
No, those are provided by the client's browser. You can't control them.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Chris" <Ch***@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.com...
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?

Feb 6 '07 #6
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.
Feb 7 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: RC | last post by:
I am using docmd.printout to send Reports (formatted as labels) to a barcode label printer. I need to collate the labels so that I print lable 1 twice, then label 2 twice, then label 3 twice, etc....
2
by: Smartin | last post by:
Question about DoCmd.PrintOut in A97. I have a form on which all the controls are unbound. There is a large textbox that the user can type stuff in and a couple labels. I am trying to code a...
1
by: Elhanan | last post by:
hi.. sorry for the cross posting, i'm simply not sure where this goes (i'm still genrating this from an asp page). i'm trying to printout normal text from IE using Generic Text Driver like...
1
by: =?Utf-8?B?S2ltIFM=?= | last post by:
I have a word document I only want to printout ( not save as file ) and I use Word printout method in backgrund but my XP operativ i so slow that a "dummy" dociment also get stored. which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.