For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > December 2004 > Printing from a Web Browser









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Printing from a Web Browser
Bill Stephenson

2004-12-01, 3:55 pm

I just spent several hours formatting a web page template with a Style
Sheet only to find that when the browser sends the page to a printer it
apparently tosses the CSS info and renders it in the default HTML. Very
frustrating....

Does anyone know where this issue really lies? Is it the browser? I
tested with several and they all seemed to do this, but I'm only
testing with one printer, an H-P Deskjet 920c. Is it the printer? Or,
is it a Mac OS X thing? I don't have a WinPC set up right now to test
with.

In any case, if anyone has any tips on providing consistency for
printed HTML documents created with a perl CGI script and delivered
across platforms, I could sure use them.

Kindest Regards,

Bill Stephenson

Mike Garner

2004-12-01, 3:55 pm

-----Original Message-----
From: Bill Stephenson [mailto:bills@secureshopper.com]
Sent: Wednesday, December 01, 2004 11:05 AM
To: beginners-cgi@perl.org
Subject: Printing from a Web Browser

I just spent several hours formatting a web page template with a Style
Sheet only to find that when the browser sends the page to a printer it
apparently tosses the CSS info and renders it in the default HTML. Very
frustrating....

Does anyone know where this issue really lies? Is it the browser? I
tested with several and they all seemed to do this, but I'm only
testing with one printer, an H-P Deskjet 920c. Is it the printer? Or,
is it a Mac OS X thing? I don't have a WinPC set up right now to test
with.

In any case, if anyone has any tips on providing consistency for
printed HTML documents created with a perl CGI script and delivered
across platforms, I could sure use them.

Kindest Regards,

Bill Stephenson


--
To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org
For additional commands, e-mail: beginners-cgi-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>


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

Bill-
I'm no expert on the subject, but I believe that CSS is media specific. I
have multiple sets of style sheets, one for screen and one for print. I
think you can create style sheets for all sorts of media (PDA, screen,
print, etc). www.alistapart.com has a lot of resources for CSS but I think
your solution is to add another CSS to the document for media.
Example from one of my CSS/XHTML pages:
<!--

<head>
<!-- snip //-->
<style type="text/css" media="screen">
@import url("styles-main.css");
</style>
<link rel="stylesheet"
type="text/css"
media="print" href="print.css" />
<!-- snip //-->
</head>

//-->

You'll see I have 2 style sheets, one for print and one for the screen. In
this case its so that I can have different styles for print but I think it
may be necessary even if I linked the same style sheet for the print
media...

Another thought might be the way the style sheet is linked. E.g using
@import url() or another way.

Again, I'm no expert and this isn't a CSS list but maybe this helps some...

~Mike


David Dorward

2004-12-01, 3:55 pm

On Wed, 2004-12-01 at 12:05 -0600, Bill Stephenson wrote:
> I just spent several hours formatting a web page template with a Style
> Sheet only to find that when the browser sends the page to a printer it
> apparently tosses the CSS info and renders it in the default HTML. Very
> frustrating....


By default a <link>ed style sheet applies to screen media only. Use the
type attribute (as described in the HTML and CSS specifications) to
specify style sheets for other media types.


David Dorward

2004-12-01, 3:55 pm

On Wed, 2004-12-01 at 18:51 +0000, David Dorward wrote:

> By default a <link>ed style sheet applies to screen media only.


Whoops, I got that backwards. Its <style> elements which default to
screen only.
--
David Dorward <http://dorward.me.uk/>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com