How to print an alternate page, I want to print a specific page instead of the .html |
How to print an alternate page, I want to print a specific page instead of the .html |
PIJoe |
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. |
pandy |
Jan 23 2007, 01:07 AM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
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? |
Brian Chandler |
Jan 23 2007, 02:04 AM
Post
#3
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
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. |
Lo-Fi Version | Time is now: 17th April 2024 - 07:56 AM |