The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How to print an alternate page, I want to print a specific page instead of the .html
PIJoe
post Jan 22 2007, 11:10 PM
Post #1





Group: Members
Posts: 1
Joined: 22-January 07
Member No.: 1,648



OK... I'm beyond frustration. I'm sure there is a SIMPLE fix to this....

I need to specify an alternate file for printing (instead of the webpage). What I'm actually doing is printing a coupon that is located in the center of the page and I don't want to print the rest of the page content. Several places make reference to this type of usage... for alternate languages, alternate devices, even specifically to get a "printer friendly" file to print instead of html

Assume the coupon is contained in a file called coupon.html (or .pdf or .txt or anything else that will work)

Based on what I read (and I have tried to figure this out....)

<link rel="alternate" media="print" href="coupon.html" /> SHOULD work... but it doesn't

you can also add ... type="text/css" but that is optional

I know how to set the coupon apart with a class and make only that class visible to a printer... but it prints in the same relative location and if it's a long webpage... you get two blank sheets with a coupon 2/3 of the way down on page one... not acceptable.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 23 2007, 01:07 AM
Post #2


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,230
Joined: 9-August 06
Member No.: 6



QUOTE(PIJoe @ Jan 23 2007, 05:10 AM) *

Based on what I read (and I have tried to figure this out....)

<link rel="alternate" media="print" href="coupon.html" /> SHOULD work... but it doesn't


Which it shouldn't. The src should refer to a CSS files, not a HTML one. Are you sure you want this to be an alternate style sheet?

QUOTE
you can also add ... type="text/css" but that is optional

No, it's not optional.


QUOTE
I know how to set the coupon apart with a class and make only that class visible to a printer... but it prints in the same relative location and if it's a long webpage... you get two blank sheets with a coupon 2/3 of the way down on page one... not acceptable.


So how do you hide the content? 'visibility: hidden'? Try 'display: none' instead. If you want more constructive advice, please link to an example page so we can take a look at what you have.

I usually don't recommend a special page for print, but in this case I wonder if it wouldn't be the best. Normally you use a print style sheet to hide stuff that isn't meaningful on a printed page, like for instance navigation. In this case you hide content. What if someone wants to print the whole page and just gets your coupon?


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Jan 23 2007, 02:04 AM
Post #3


Jocular coder
********

Group: Members
Posts: 2,212
Joined: 31-August 06
Member No.: 43



QUOTE(PIJoe @ Jan 23 2007, 01:10 PM) *


I need to specify an alternate file for printing (instead of the webpage). What I'm actually doing is printing a coupon that is located in the center of the page and I don't want to print the rest of the page content. Several places make reference to this type of usage... for alternate languages, alternate devices, even specifically to get a "printer friendly" file to print instead of html



(I presume this is for visitors to print the coupon, not something that you just do yourself.)

Keep it simple: put a link under the coupon "Print coupon", which goes to a page with just the coupon in; use javascript to put it in a new window, and automatically print onload (user will have to confirm). If the formatting of the coupon itself is at all complex, and particularly if it's just black and white, you could make the whole coupon an image. Use CSS to make it the right printing size, not forgetting that no country in the world with only about two exceptions has paper 8.5" wide, so make sure it fits on A4.


--------------------
Brian Chandler
Nothing in this post constitutes "commercial solicitation". PayPal does not solicit residents of Japan. Contents may settle in transit. "Legal mind" may or may not be brain-damaged.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 1st August 2014 - 02:48 AM