473,406 Members | 2,769 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,406 software developers and data experts.

To print an alternate page

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
21 5676
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
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

"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
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

"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
"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
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
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

"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
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
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
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
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
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
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
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
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

"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
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
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
[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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Manfred Schwab | last post by:
Recording messages and print statements in a textfile during program execution. Is there a similar command to redirect errormessages or print statements into a standart asciifile during...
2
by: Rob McLennan - ZETLAND | last post by:
Hi, I have set up an external stylesheet, named "print.css", to format the style of all pages printed from my company's website. I've been previewing my changes to the stylesheet by doing...
1
by: Rajah | last post by:
I have a webpage which I need to format for printing. The webpage contains a Confirmation and an Acknowledgement. Users should be able to print the Confirmation and the Acknowledgement separately....
13
by: Toby A Inkster | last post by:
www.authoring.stylesheets] For ages I have provided links to alternate stylesheets from my pages as per W3C recommendations: <link rel="stylesheet" href="baz" type="text/css" title="Baz"...
3
by: Gary Finnigan | last post by:
I have made a style sheet that determines which div's display and which not for use in a website. However when I click on the link the invokes the sheet it still prints everything on the page, but...
4
by: Steel | last post by:
Hi at all, I have a long HTML page with some photos (2 large and 2 little) If a user print the page I'ld want that he can print as I want like a pdf file. Is it possible? I.e.:Print margins and...
16
by: Neal | last post by:
Hi, I saw the VB6 Code to do this at this link: http://www.dotnet247.com/247reference/msgs/11/56581.aspx The VB6 Code reads as follows: Private Type Rect Left As Long
9
by: Rhino | last post by:
How hard (and desireable) would it be to give the user certain choices when it comes to printing web pages? The pages on my site use colours and pictures and contain an imbedded menu, among...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.