PDA

View Full Version : Prints text only.



Jonny
07-08-2006, 09:43 PM
Is this possible:

What i want it to do is have a button called 'Print Screen'. Now when you click this button ALL it prints is the text. So when you click the button or text it just comes up with the print set upbox and ALL it prints is ONLY the text. Can anyone help?

Now i need this for a Forum, IF. Does anyone have the code?

Twey
07-08-2006, 09:56 PM
This isn't Javascript, it's CSS.
The "Print Screen" button isn't possible, but using print stylesheets, you can print only text when the user decides to print or view a print preview.
<style type="text/css">
@media print {
img {
display: none;
}
* {
background-image: none;
border-style: none;
background-color: white;
color: black;
}
}
</style>

Jonny
07-08-2006, 10:03 PM
Well thats it but where would i add it to an Invision Free Forum board ?

And do i need to edit any of it ?

Twey
07-08-2006, 10:11 PM
The head, and no.

Jonny
07-08-2006, 10:20 PM
I just inserted it and put it in the <head> section of the forum and when i clicked print and then preferences it said 'Text + Images'. Does this matter or will it just print the text anyway ?

Jonny
07-08-2006, 10:22 PM
Right print preview it doesnt show the images apart from like 'Moderation Operations' lol but is there now a code which makes it print landscape ??

Twey
07-08-2006, 10:35 PM
No. :)

Jonny
07-08-2006, 10:39 PM
O :( Well i guess its not helpful .. Cause on the Forum it cuts off bits of the text.

Twey
07-08-2006, 10:57 PM
You'll just have to ask the user to set the page orientation to landscape when printing.

Jonny
07-08-2006, 11:17 PM
Last question .. lol. Can i make it so at the bottom of the Topic theres text saying 'Print Page'. When you click it, it comes up with the print options and it includes the code above, the print only text code.

Jonny
07-08-2006, 11:38 PM
Errr LMAO. I just saw that 2 mm above Edit Topic in the Forum was a link saying 'Printable Version' and it came out fine :S So sorry ..

Twey
07-08-2006, 11:41 PM
<a href="javascript:window.print();">Print</a>The above code needs to go in the head of the document, not in a link.