473,410 Members | 1,950 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,410 software developers and data experts.

PRINTABLE PAGE WITHOUT SECOND DOWNLOAD FOR CONTENT

Hi,

I was wondering what would be the way to have the same content
rendered in a different way; say from a page with navigation bars
presenting the text in two columns to a "printable" one without having
to download the content again.

Is this possible in a more or less cross-browser compliant way?

Thnx
Jul 20 '05 #1
7 1951
Sometime around 26 Oct 2003 20:20:55 -0800, Albretch is reported to have
stated:
Hi,
G'day,

I was wondering what would be the way to have the same content
rendered in a different way; say from a page with navigation bars
presenting the text in two columns to a "printable" one without having
to download the content again.


<link rel="stylesheet" href="print.css" type="text/css" media="print">

Apply appropriate styles in print.css

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #2
Mark Parnell <we*******@clarkecomputers.com.au> wrote:
<link rel="stylesheet" href="print.css" type="text/css"
media="print">

Apply appropriate styles in print.css


Or use

<link rel="stylesheet" href="common.css" type="text/css"
media="all">

and make common.css contain, among other things,

@media print { ... }

Disadvantage: the browser loads the CSS rules for printing even when
they will not be used. (But usually this does not matter much, it's a
relatively small piece of data - and you may save an HTTP transaction.)

Advantages: you only need one <link> element, you can create and edit
the style sheet without comparing constructs in two files, and
you can group CSS rules more flexibly (e.g. by using several
@media rules so that rules for printing an element appear right after
general or screen-only rules for it).

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #3
"Jukka K. Korpela" <jk******@cs.tut.fi> writes:
<link rel="stylesheet" href="common.css" type="text/css"
media="all">

and make common.css contain, among other things,

@media print { ... }


I had a problem with IE5.0 once doing this (I think the media type was
screen,print,projection not all) - under certain circumstances, IE5
would interpret the print stylesheet in an @media screen situation.

Since the print stylesheet had the occasional
div.navigation { display: none; } and similar in it, this became very
noticeable.

Straightforward CSS-hiding to solve it, obviously.

--
Chris
Jul 20 '05 #4
Jukka K. Korpela wrote:

<link rel="stylesheet" href="common.css" type="text/css"
media="all">

and make common.css contain, among other things,

@media print { ... }


One additional disadvantage: IE 5.x/Mac does not understand @media
rules, but IE 5.x/Mac is otherwise a good browser in terms of css.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #5
....

"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message news:<Xn*****************************@193.229.0.31 >...
- and you may save an HTTP transaction


Well, I think, we are not understanding each other well. I am
actually trying not to have to download -the content- a second time.

For an example of exactly I am trying to avoid:

1._ go:
http://www.javaworld.com/javaworld/j...w-11-hood.html

which includes in its meta tags:
<link rel="stylesheet" type ="text/css" href="/includes/style.css">

2._ Click on "Printer-friendly version" and you will be directed to:
http://www.javaworld.com/javaworld/j...11-hood_p.html

<style type="text/css">
code {font: 110%;}
pre {font: 100%;}
td {font: 90%;}
</style>

The first page renders a navigational bar on the left the second one
none.

But the content itself is downloaded twice from the server. This is
namely what I am trying to avoid.

The only "compatible" way I know of doing this (I am not a designer)
is using frames-based pages. However I am –trying- to use XHTML
strict.

I think I read somewhere if you use <div>s the browser does not
download the enclosed stuff again, but:

1._ I wonder how compliant/cross-browser it is

2._ It sounds a little odd to me, that browsers cache <div>s inside
of the HTML proper as they can cache pictures and other static
content.

Also stretching this idea just a little bit more, you could have
browsers kind of doing CVS work. Only requesting what is new or has
changed within a page . . .

Please, could you clarify this to me?

I need for you to share with me your experience if you have tried to
work around this. "Standards" may or may not be what is happening out
there.

Thanks
Jul 20 '05 #6
lb*****@hotmail.com (Albretch) wrote:
- and you may save an HTTP transaction
Well, I think, we are not understanding each other well. I am
actually trying not to have to download -the content- a second
time.


So it seems. Both approaches suggested save that. What I was referring
to was the transaction of fetching another style sheet.
For an example of exactly I am trying to avoid:
It has a link to a "Printer-fiendly version", which is a separate
document. We told how to use a style sheet instead.
The only "compatible" way I know of doing this (I am not a
designer) is using frames-based pages.
I have no idea of what you are talking about here. My experience with
frames is that the user gets the wrong frame printed, except on bad
days, when the printer spits out a hundred pages of garbage. So frames
are a problem, not a solution, in printing.
I think I read somewhere if you use <div>s the browser does not
download the enclosed stuff again,
That would be an interesting phenomenon.
1._ I wonder how compliant/cross-browser it is
It's pure imagination.
Also stretching this idea just a little bit more, you could have
browsers kind of doing CVS work.
I'm not going to make a guess on the value of the symbol "CVS" here,
but I'm sure you're on the wrong track now.
I need for you to share with me your experience if you have tried
to work around this.


"This"? Using a print style sheet is a solution, not a problem.
No need to work around it. Now, if you asked how to set up _several_
alternate style sheets in a manner that works even on IE, _that_ would
be an interesting question (but basically off-topic here).

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #7
Albretch pounced upon this pigeonhole and pronounced:
...

"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message news:<Xn*****************************@193.229.0.31 >...
- and you may save an HTTP transaction
Well, I think, we are not understanding each other well. I am
actually trying not to have to download -the content- a second time.

For an example of exactly I am trying to avoid:

1._ go:
http://www.javaworld.com/javaworld/j...w-11-hood.html

which includes in its meta tags:
<link rel="stylesheet" type ="text/css" href="/includes/style.css">

2._ Click on "Printer-friendly version" and you will be directed to:
http://www.javaworld.com/javaworld/j...11-hood_p.html

<style type="text/css">
code {font: 110%;}
pre {font: 100%;}
td {font: 90%;}
</style>

The first page renders a navigational bar on the left the second one
none.

But the content itself is downloaded twice from the server. This is
namely what I am trying to avoid.


Had the site been authored correctly, there would be no need for a second
"printer-compatible" document and additional bandwidth.
The only "compatible" way I know of doing this (I am not a designer)
is using frames-based pages. However I am –trying- to use XHTML
strict.


Frames are *surely not* the answer. All you need is to properly use CSS,
in a print stylesheet.

This fairly simple site of mine uses a print style sheet.
http://www.countryrode.com/

<style type="text/css" media="all">@import "../style/rode3.css"; </style>
<link type="text/css" rel="stylesheet" href="../style/crprint.css"
media="print" />

Go ahead; do a print preview. The nav column and other bits you normally
wouldn't want to print are gone.

<snip>

--
-bts
-This space intentionally left blank.
Jul 20 '05 #8

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

Similar topics

2
by: Matthew Sims | last post by:
Is it possible to force a download without using the readfile function? My website setup consists of my server that serves the web pages plus a high-speed file server elsewhere on the internet...
3
by: mvargasp | last post by:
Hi all, I have a web form which contains a frame, (a form containing a menu on the left and a web form containing a datagrid on the right). Also there is a button (right side) which transforms...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
2
by: Ken Varn | last post by:
I have an ASP.NET page that incorporates the following code on a button press. private void DownloadTag_Command(object sender, CommandEventArgs e) { FileStream fs; String Filename; Filename...
2
by: Bryan | last post by:
Apologies if this is a noob question, but I've been struggling with this for quite a while... I'm trying to convert a byte array (encrypted authorization code) into a *screen-printable* string...
2
by: marss | last post by:
I have a long page that contains few separate information blocks. When I print the page by means of window.print(), the content is automatically divided by pages. I look through and find I can...
1
by: Edward | last post by:
I created a simple CSS layout (code and example below) for bloggin/writing but ran into five issues that I need help with: 1. How do I get rid of the right-margin red line on the last three...
1
by: Jurjen de Groot | last post by:
I have an 'Export' button on my page, when clicking this button, a file is streamed to the client like this : lblMessage.Text = "Thank you for downloading..."; System.IO.FileInfo objFI = new...
3
by: Jonathan Wood | last post by:
I noticed that some sites will display content and have a Print link that will display the same content but without all the unneeded graphics and colors. Anyone here ever implemented this? I...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.