PDA

View Full Version : Alternate Print



Scrounger
01-16-2008, 06:03 AM
1) Script Title: <link rel=alternate media=print href="printversion.doc">

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/printstyle.htm

3) Describe problem: I've tried to use this on one of my pages and no matter what I do, I can't get it to work. It seems simple but I'm just not getting it right for some reason. The page is at http://www.cubpack88.org/pinewood_wisedom.htm

Regards,

Matthew

Twey
01-16-2008, 06:27 AM
This "script" isn't supported by most browsers. It's probably only still in the archives so as not to break links.

Scrounger
01-16-2008, 06:29 AM
I was using FireFox and IE 7.

I tried the CSS type and also some script. Nothing seems to work. Is it still possible to do this?

jscheuer1
01-16-2008, 07:27 AM
This is a cross browser method:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="screen.css" type="text/css" media="screen">
<link rel="stylesheet" href="print.css" type="text/css" media="print">
</head>
<body>
Hi
</body>
</html>

It uses two separate stylesheets, one for the screen and one for the printer. Here are examples of the stylesheets:

screen.css

body {
font:90% serif;
color:red;
}

print.css

body {
font:bold 200% sans-serif;
}

Scrounger
01-16-2008, 02:51 PM
Thanks for the assist John. I'll have to do some reading on this one since I was not able to get he style sheets or css to work with frontpage when I just wanted to print out the upcoming events on our website. www.cubpack88.org

With two styles does that mean that I have to assign a style to everything on the page or just use one style for the print and nothing for the screen since it will use the formating that is in the html code.

jscheuer1
01-16-2008, 04:42 PM
See also:

http://www.dynamicdrive.com/forums/showthread.php?p=126712#post126712

Where I expanded upon this. You could instead mark your on page style section(s) media="screen", ex (corrected for proper type attribute):


<style type="text/css" media="screen">

.lcdstyle{ /*Example CSS to create LCD countdown look*/
background-color:black;
color:yellow;
font: bold 18px Arial;
padding: 3px;
}

.lcdstyle sup{ /*Example CSS to create LCD countdown look*/
font-size: 80%
}

</style>

But inline styles, ex:


. . . 024" height="96" bgcolor="#000000" style="border-collapse: collapse">
<tr> . . .

will apply to both print and screen.

More importantly, you must be more precise in your print styles, as also noted in your other thread (http://www.dynamicdrive.com/forums/showthread.php?t=28408) where I mentioned:


Also the suggestion given here:



body {visibility:hidden;}
.print {visibility:visible;}

will never work because visibility is inherited - unless you have content outside the body, which is wrong to do anyway. If the entire body is hidden, nothing in it can be seen.