Click to See Complete Forum and Search --> : print webpage as txt file...


man
07-24-2003, 11:15 AM
Hi out there, i have a problem with printing my page...

I want to print a special *txt file if i use the print button in my webpage.

For example:
I have a disclaimer.htm and if someone want to print it out he get´s the disclaimer.txt

------------------------------------
<form>
<p align="center">
<INPUT TYPE=Button OnClick=?disclaimer.txt?
value="print">
</form>
----------------------------------------------------

i saw it, but did not find it till yet.
Have you heard of this posibility

pyro
07-24-2003, 11:19 AM
You can specify an alternate document to print using this:

<link rel="alternate" media="print" href="printversion.txt">

man
07-24-2003, 11:28 AM
could you give me an complet example?
Would this work with opera browser?


thx

pyro
07-24-2003, 11:33 AM
It should work in Opera...

<html>
<head>
<link rel="alternate" media="print" href="printversion.txt">
</head>
<body>
This is the body... it shouldn't be printed.
</body>
</html>

man
07-24-2003, 01:43 PM
Originally posted by pyro
It should work in Opera...

<html>
<head>
<link rel="alternate" media="print" href="printversion.txt">
</head>
<body>
This is the body... it shouldn't be printed.
</body>
</html>

Hi, this works fine, but how can i hide the info (link) below?
For example:
file://c:\Document%20and%....

pyro
07-24-2003, 04:25 PM
What do you want to do? :confused:

man
07-24-2003, 05:16 PM
Sorry, forget the last question!

Now i have an other problem with this script.

---------------------------------------------------
<script>
if (window.self) window.print();
</script>
<style>
---------------------------------------------------

It does not work with opera. Why?

pyro
07-24-2003, 05:26 PM
A couple of things:

One, what is your if (window.self) doing in there?

Two, <script> should be <script type="text/javascript">

Three, Opera needs you to run the window.print() after the entire pages is loaded. Try this:

<script type="text/javascript">
function printPage() {
window.print();
}
window.onload = printPage;
</script>

man
07-25-2003, 02:45 AM
ok, I see what you mean...

thx for your help!

I´m not as fit in scripting as you are, because I´m an absolutly non programmer, but i try to understand.

Now I´m able to print html page or txt file.
Thats what i wanted...

----------------------------------------------------------------

If i printed out my disclaimer, there i saw the Link (down the page) where it comes from printed out, too! Is it possible to hide this line?

For example the Disclaimer at my page:
look at http://www.hackstube.de/print/eng.htm