By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,847 Members | 2,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,847 IT Pros & Developers. It's quick & easy.

To print an alternate page

P: n/a
Hi at all,
I have a very long html page with many photo.
Therefore the best to print this page is to print the some page as PDF.
Therefore I maked a PDF file like my page to print best.
I'ld want that when the user press the print button in the browser , it
print automatically the pdf file and not the html page.
To do that I insert at the top of my page:
<link media="print" rel="alternate" href="printthepage.pdf">
But it do not work and the browser print the html page.
How can I do please?
Steel
Jul 21 '05 #1
Share this Question
Share on Google+
21 Replies


P: n/a
Steel wrote:
Hi at all,
I have a very long html page with many photo.
Therefore the best to print this page is to print the some page as PDF.
Therefore I maked a PDF file like my page to print best.
I'ld want that when the user press the print button in the browser , it
print automatically the pdf file and not the html page.
To do that I insert at the top of my page:
<link media="print" rel="alternate" href="printthepage.pdf">
But it do not work and the browser print the html page.
How can I do please?
Steel


I think the media attribute is only meaningful if your LINK tag points to a
CSS stylesheet.

Here are some things you could do instead:

1. Add a clickable link like this:
<A href="printthepage.pdf">Click here for a PDF file of this page</A>

2. Create a CSS stylesheet for print media so you page prints correctly
anyway. (Some browsers support these better than others.)

3. Consider breaking your very long HTML page into a sequence of
smaller pages.

Phil
--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 21 '05 #2

P: n/a
Philip Ronan <ph***********@virgin.net>:
Steel wrote:
Therefore I maked a PDF file like my page to print best.
I'ld want that when the user press the print button in the browser , it
print automatically the pdf file and not the html page.
<link media="print" rel="alternate" href="printthepage.pdf">
I think the media attribute is only meaningful if your LINK tag points
to a CSS stylesheet.


No, the approach was absolutely correct, but browser support is somewhat
limited, nicely said.
<A href="printthepage.pdf">Click here for a PDF file of this page</A>
"Click here" links are bad---what else would you do with a link, if you
are using a mouse? 'Rel' is a valid attribute of 'a', too, but 'media' is
not.
2. Create a CSS stylesheet for print media
Hey, don't you get on topic!!11
3. Consider breaking your very long HTML page into a sequence of
smaller pages.


That would make printing actually harder!

--
Fighting for peace is like fucking for virginity.
Jul 21 '05 #3

P: n/a

"Christoph Paeper" <ch**************@nurfuerspam.de> wrote in message
news:opsgx6cprvb8p244@crissov...
Philip Ronan <ph***********@virgin.net>:
Steel wrote:
Therefore I maked a PDF file like my page to print best.
I'ld want that when the user press the print button in the browser , it print automatically the pdf file and not the html page.
<link media="print" rel="alternate" href="printthepage.pdf">


I think the media attribute is only meaningful if your LINK tag points
to a CSS stylesheet.


No, the approach was absolutely correct, but browser support is somewhat
limited, nicely said.
<A href="printthepage.pdf">Click here for a PDF file of this page</A>


"Click here" links are bad---what else would you do with a link, if you
are using a mouse?


A fellow opens a fish market, and is putting up a sign reading "Fresh Fish
Sold Here". A passerby stops and says, "Well, of course your fish is *sold*
here. No one is going to think you're giving it away."

The fishmonger says, "You're right", and takes down the sign. The next day,
while he's putting up a sign reading "Fresh Fish Here", a passerby stops and
says, "Well, of course you're selling the fish *here*. This is where your
store is!"

The fishmonger says, "You're right", and takes down the sign. The next day,
while he's putting up a sign reading "Fresh Fish", a passerby stops and
says, "Well, I would hope your fish is *fresh*. If you make a point of
saying so, you'll only make people suspicious that it really isn't."

The fishmonger says, "You're right", and takes down the sign. The next day,
while he's putting up a sign reading "Fish", a passerby stops and says,
"Well, everyone already knows you're selling *fish*. You can smell it all
the way down the block!"

The fishmonger says, "You're right", and takes down the sign. And never puts
up another.

Jul 21 '05 #4

P: n/a
On Thu, 4 Nov 2004 11:38:48 -0500, Harlan Messinger
<h.*********@comcast.net> wrote:
A fellow opens a fish market, and is putting up a sign reading "Fresh
Fish
Sold Here". A passerby stops and says, "Well, of course your fish is
*sold*
here. No one is going to think you're giving it away."

The fishmonger says, "You're right", and takes down the sign. The next
day,
while he's putting up a sign reading "Fresh Fish Here", a passerby stops
and
says, "Well, of course you're selling the fish *here*. This is where your
store is!"

The fishmonger says, "You're right", and takes down the sign. The next
day,
while he's putting up a sign reading "Fresh Fish", a passerby stops and
says, "Well, I would hope your fish is *fresh*. If you make a point of
saying so, you'll only make people suspicious that it really isn't."

The fishmonger says, "You're right", and takes down the sign. The next
day,
while he's putting up a sign reading "Fish", a passerby stops and says,
"Well, everyone already knows you're selling *fish*. You can smell it all
the way down the block!"

The fishmonger says, "You're right", and takes down the sign. And never
puts
up another.


So.. you're saying that "Click here" smells like fish?

Jul 21 '05 #5

P: n/a

"Neal" <ne*****@yahoo.com> wrote in message
news:op**************@news.individual.net...
On Thu, 4 Nov 2004 11:38:48 -0500, Harlan Messinger
<h.*********@comcast.net> wrote:
A fellow opens a fish market, and is putting up a sign reading "Fresh
Fish
Sold Here". A passerby stops and says, "Well, of course your fish is
*sold*
here. No one is going to think you're giving it away."

The fishmonger says, "You're right", and takes down the sign. The next
day,
while he's putting up a sign reading "Fresh Fish Here", a passerby stops
and
says, "Well, of course you're selling the fish *here*. This is where your store is!"

The fishmonger says, "You're right", and takes down the sign. The next
day,
while he's putting up a sign reading "Fresh Fish", a passerby stops and
says, "Well, I would hope your fish is *fresh*. If you make a point of
saying so, you'll only make people suspicious that it really isn't."

The fishmonger says, "You're right", and takes down the sign. The next
day,
while he's putting up a sign reading "Fish", a passerby stops and says,
"Well, everyone already knows you're selling *fish*. You can smell it all the way down the block!"

The fishmonger says, "You're right", and takes down the sign. And never
puts
up another.


So.. you're saying that "Click here" smells like fish?


:-) No, just that every instance of a redundant or self-evident words is not
automatically "bad practice".

Jul 21 '05 #6

P: n/a
"Harlan Messinger" <h.*********@comcast.net> writes:
"Christoph Paeper" <ch**************@nurfuerspam.de> wrote in message
"Click here" links are bad---what else would you do with a link, if you
are using a mouse?


A fellow opens a fish market, and is putting up a sign reading "Fresh Fish
Sold Here". A passerby stops and says, "Well, of course your fish is *sold*
here. No one is going to think you're giving it away."


*grin*

I use that one (though the version I originally heard had 'Today' in
the sign too) to demonstrate things to think about when writing
concise text for the web.

I then pick an appropriately verbose paragraph from a corporate
site. Usually the students manage to get it down to between a third
and a half of the length while keeping the same information without
difficulty.

Hadn't thought of using it on the 'click here' links, though - thanks.

--
Chris
Jul 21 '05 #7

P: n/a
Christoph Paeper wrote:
Philip Ronan <ph***********@virgin.net>:
Steel wrote:
Therefore I maked a PDF file like my page to print best.
I'ld want that when the user press the print button in the browser , it
print automatically the pdf file and not the html page.
<link media="print" rel="alternate" href="printthepage.pdf">


I think the media attribute is only meaningful if your LINK tag points
to a CSS stylesheet.


No, the approach was absolutely correct, but browser support is somewhat
limited, nicely said.


That's not my understanding of things. According to the HTML spec, the media
attribute specifies the intended destination medium for style information. I
don't think a PDF file actually qualifies as "style information". There is
nothing in the OP's syntax that tell the browser it should be printing some
other resource besides this one.
<A href="printthepage.pdf">Click here for a PDF file of this page</A>


"Click here" links are bad---what else would you do with a link, if you
are using a mouse? 'Rel' is a valid attribute of 'a', too, but 'media' is
not.


yeah, whatever
3. Consider breaking your very long HTML page into a sequence of
smaller pages.


That would make printing actually harder!


There are various reasons why breaking a very long page into several smaller
ones is often a very good idea. Besides, I just told the guy to "consider"
it. What's your problem?

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 21 '05 #8

P: n/a
Philip Ronan <ph***********@virgin.net>:
Christoph Paeper wrote:
Philip Ronan <ph***********@virgin.net>:
Steel wrote: <link media="print" rel="alternate" href="printthepage.pdf">

I think the media attribute is only meaningful if your LINK tag points
to a CSS stylesheet.
No, the approach was absolutely correct,


That's not my understanding of things. According to the HTML spec, the
media attribute specifies the intended destination medium for style
information.


That's of course true for the 'media' attribute of the 'style' element and
although that might have been the reason for its inclusion for 'link',
too, it's clear that it has a broader meaning there, e.g. in this example
from the chapter misguidingly called '12.3.3 Links and search engines':

<LINK media="print" title="The manual in postscript"
type="application/postscript"
rel="alternate"
href="http://someplace.com/manual/postscript.ps">
3. Consider breaking your very long HTML page into a sequence of
smaller pages.


That would make printing actually harder!


There are various reasons why breaking a very long page into several
smaller ones is often a very good idea.


Sure, but a print-out is not one of them.
What's your problem?


With you? I don't have one, should I?

--
Useless Fact #11:
The Hawaiian alphabet has 12 letters.
Jul 21 '05 #9

P: n/a

"Steel" <NO****@hotmail.com> wrote in message
news:Yl*******************@twister1.libero.it...
Hi at all,
I have a very long html page with many photo.
Therefore the best to print this page is to print the some page as PDF.
Therefore I maked a PDF file like my page to print best.
I'ld want that when the user press the print button in the browser , it
print automatically the pdf file and not the html page.
To do that I insert at the top of my page:
<link media="print" rel="alternate" href="printthepage.pdf">


This strikes me as inadvisable for three reasons:

1. The user may *want* to print the web page.

2. The user doesn't necessary have Acrobat, and isn't necessarily able or
doesn't necessarily want to download and install it right this instant.

3. You should never cause another application to load without warning the
user in advance what's he's loading and, generally, how large it is.

Jul 21 '05 #10

P: n/a
Christoph Paeper wrote:
That's of course true for the 'media' attribute of the 'style' element and
although that might have been the reason for its inclusion for 'link',
too, it's clear that it has a broader meaning there, e.g. in this example
from the chapter misguidingly called '12.3.3 Links and search engines':

<LINK media="print" title="The manual in postscript"
type="application/postscript"
rel="alternate"
href="http://someplace.com/manual/postscript.ps">


So where does it say that user agents should look for a print media resource
when asked to print a screen media resource? And what are they supposed to
do if the print media resource can't be used. Not all browser systems
support PDF files. Very few support Postscript files

I agree that some browsers could do more to present the content available
via <LINK> elements, but I don't think you should expect them to use it by
default under circumstances like this. What if I *want* to print the screen
version of a document?

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 21 '05 #11

P: n/a
Philip Ronan wrote:
That's not my understanding of things. According to the HTML spec,
the media attribute specifies the intended destination medium for
style information.
Only if the <LINK> is to a stylesheet. You can use <LINK> for other
things, too, such as alternate representations of a document.
Philip Ronan <ph***********@virgin.net>:
<A href="printthepage.pdf">Click here for a PDF file of this
page</A> Christoph Paeper wrote:
"Click here" links are bad---what else would you do with a link, if
you are using a mouse?

yeah, whatever


Gee, what a withering argument you presented.
3. Consider breaking your very long HTML page into a sequence of
smaller pages.


That would make printing actually harder!


There are various reasons why breaking a very long page into several
smaller ones is often a very good idea. Besides, I just told the guy
to "consider" it. What's your problem?


I was going to ask you the same thing. C. Paeper presented some very
reasonable arguments, in very reasonable language. Is there some reason
for your cantankerous response?

--
Brian (remove "invalid" to email me)
Jul 21 '05 #12

P: n/a
Philip Ronan wrote:
Christoph Paeper wrote:

e.g. in this example from the chapter misguidingly called
'12.3.3 Links and search engines':

<LINK media="print" title="The manual in postscript"
type="application/postscript" rel="alternate"
href="http://someplace.com/manual/postscript.ps">

So where does it say that user agents should look for a print media
resource when asked to print a screen media resource?


HTML is a markup language. It leaves rendering and related questions to
the user agent to decide. At most, you might find a suggestion for how a
ua could handle certain markup constructs, or what current practice is.
The <LINK> element is defined here:

http://www.w3.org/TR/html4/struct/links.html#h-12.3

Further reading:

http://www.htmlhelp.com/reference/html40/head/link.html
And what are they supposed to do if the print media resource can't be
used.
Hopefully, ignore it. That would be most sensible.
I agree that some browsers could do more to present the content
available via <LINK> elements, but I don't think you should expect
them to use it by default under circumstances like this.
As an author, you're right. But then, as an author, there is not much
you can expect beyond support for basic html 4 markup.
What if I *want* to print the screen version of a document?


Hopefully, your browser gives you the option. If not, you might want to
ask the maker to add that functionality.

--
Brian (remove "invalid" to email me)
Jul 21 '05 #13

P: n/a
Steel wrote:
I have a very long html page with many photo. Therefore the best to
print this page is to print the some page as PDF.
According to you. Some visitors may prefer to print the html document,
or may not have a pdf reader.
Therefore I maked a PDF file like my page to print best.
Ok. For your information, you can also suggest a presentation for an
html document with a css print stylesheet.
I'ld want that when the user press the print button in the browser ,
it print automatically the pdf file and not the html page.
You cannot do that with html, which is only a markup language. All you
can do is provide users with options, and let them sort out what to do
with them.
To do that I insert at the top of my page: <link media="print"
rel="alternate" href="printthepage.pdf">
Good idea, and in principle, it is what you should do. Provide a pdf
version of the page, and give users access via <LINK>.
But it do not work and the browser print the html page.


Browser support for <LINK> is sadly limited. My suggestion: in addition
to the <LINK> element, provide an anchor link in the <BODY> of your
document:

<a href="printthepage.pdf" title="pdf version of this document"
media="print">printthepage.pdf</a>

Note that "printthepage.pdf" is not the most meaningful page for a
document of any sort on the www.

--
Brian (remove "invalid" to email me)
Jul 21 '05 #14

P: n/a
Brian wrote:
Philip Ronan wrote:
Christoph Paeper wrote:

e.g. in this example from the chapter misguidingly called
'12.3.3 Links and search engines':

<LINK media="print" title="The manual in postscript"
type="application/postscript" rel="alternate"
href="http://someplace.com/manual/postscript.ps">

So where does it say that user agents should look for a print media
resource when asked to print a screen media resource?


HTML is a markup language. It leaves rendering and related questions to
the user agent to decide. At most, you might find a suggestion for how a
ua could handle certain markup constructs, or what current practice is.
The <LINK> element is defined here:


Wait a minute.

Guy asks a question here. It sits around unanswered for 4 hours until I make
a few suggestions to the OP on how to solve his problem. Then within 30
minutes I get you and Christoph stamping all over my contribution with some
half-arsed argument that basically boils down to saying "Yes. You're
perfectly correct. Now all you have to do is wait ten years until someone
produces a browser capable of understanding what you're trying to do". And
you think you're being helpful?

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 21 '05 #15

P: n/a
Harlan Messinger wrote:
"Steel" wrote ...
<link media="print" rel="alternate" href="printthepage.pdf">
This strikes me as inadvisable for three reasons:

1. The user may *want* to print the web page.


That could be a problem, since the ua may not offer the user the choice
when the print function is activated.
2. The user doesn't necessary have Acrobat, and isn't necessarily
able or doesn't necessarily want to download and install it right
this instant.
In that case, the ua should ignore the <link>ed document, or at least
ask the user what it should do (much like selecting an <a> link with
unknown MIME type.
3. You should never cause another application to load
On practical grounds, that's true. But <link> does not really cause
anything to happen unless the browser is configured that way. This seems
more like a ua issue than an authoring one.
without warning the user in advance what's he's loading and,
generally, how large it is.


Your advice to warn the user is spot on. This can be done via the title
attribute.

<link media="print" rel="alternate" href="printthepage.pdf" title="pdf
format, 34kB">

--
Brian (remove "invalid" to email me)
Jul 21 '05 #16

P: n/a
In comp.infosystems.www.authoring.stylesheets Neal said:
So.. you're saying that "Click here" smells like fish?


but it tastes like chicken
--
the facts and opinions expressed by brucies
l i t t l e v o i c e s
are not necessarily the same as those held by brucie.
Jul 21 '05 #17

P: n/a
Philip Ronan wrote:
Wait a minute.

Guy asks a question here. It sits around unanswered for 4 hours until
I make a few suggestions to the OP on how to solve his problem.
Fairly typical for usenet.
Then within 30 minutes I get you and Christoph stamping all over my
contribution with some half-arsed argument


Also fairly typical for usenet. This is a discussion forum, not a
helpdesk. When someone brings up an issue, others discuss it.

One more thing that's pretty typical for usenet: when you demonstrate a
belligerent attitude, you get killfiled. That's even if your
belligerence were justified, and here I don't see how it is. You seem
upset merely because we don't agree with you. Sheesh, get a grip and
calm down.

--
Brian (remove "invalid" to email me)
Jul 21 '05 #18

P: n/a

"Brian" <us*****@julietremblay.com.invalid> wrote in message
news:RC*********************@bgtnsc04-news.ops.worldnet.att.net...
Harlan Messinger wrote:
3. You should never cause another application to load


On practical grounds, that's true. But <link> does not really cause
anything to happen unless the browser is configured that way. This seems
more like a ua issue than an authoring one.
without warning the user in advance what's he's loading and,
generally, how large it is.


Your advice to warn the user is spot on. This can be done via the title
attribute.

<link media="print" rel="alternate" href="printthepage.pdf" title="pdf
format, 34kB">


When would the user ever see the value of the TITLE attribute?

Jul 21 '05 #19

P: n/a
Harlan Messinger wrote:
"Brian" wrote
<link media="print" rel="alternate" href="printthepage.pdf" title="pdf
format, 34kB">

When would the user ever see the value of the TITLE attribute?

Any UA which supports alternate stylesheets.
Jul 21 '05 #20

P: n/a
On Thu, 04 Nov 2004 18:29:22 -0500, Neal <ne*****@yahoo.com> wrote:
Harlan Messinger wrote:
"Brian" wrote
<link media="print" rel="alternate" href="printthepage.pdf" title="pdf
format, 34kB">

When would the user ever see the value of the TITLE attribute?

Any UA which supports alternate stylesheets.


Um? The above has nothing to do with stylesheets. The title will be
displayed by better browsers via whatever means they use to display
<link> elements. Lynx is a good example - when a title is present it
uses the title instead of the rel/rev value in it's link toolbar.

Now in cases like this where the link is not intended to create a link
but is intended to supplant the standard print function Harlan raises
a good point. Even if the browser does display the title somewhere via
the link toolbar the user still has no way of knowing that the
standard print button is being hi-jacked by this "pdf format, 34kB".

Steve

Jul 21 '05 #21

P: n/a
[re <link media="print" ...>

Harlan Messinger wrote:
"Brian" work...
Your advice to warn the user is spot on. This can be done via the
title attribute.

<link media="print" rel="alternate" href="printthepage.pdf"
title="pdf format, 34kB">

When would the user ever see the value of the TITLE attribute?

Ah, right, in this scenario, they wouldn't. I hadn't thought of that.
This is probably not a good idea after all, unless any ua that offers to
print a <link>ed document warns the user first, or otherwise gives them
a choice.

On principle, the <link> is sound -- html is markup, not commands -- but
I don't know how current browsers handle it, nor how they will handle it
in the future. It might be an interesting thing to check if I get some
time on my hands.

--
Brian (remove "invalid" to email me)
Jul 21 '05 #22

This discussion thread is closed

Replies have been disabled for this discussion.