Topic: Success of controling paged media with CSS??? Pages that link to <a href="https://ozoneasylum.com/backlink?for=10938" title="Pages that link to Topic: Success of controling paged media with CSS???" rel="nofollow" >Topic: Success of controling paged media with CSS???\

 
Author Thread
Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

IP logged posted posted 03-16-2003 19:57 Edit Quote

Has anyone had much success with controlling the paged media? I am able to control font, tables, anchor tags and so on... but I really need to have more control over the paged media: specifically the margins. No matter what I do, I'm not able to get the margins to change. I need a smaller margin... I've tried this, but to no prevail:

@page {
margin: 1cm;
}
body {margin:0px;}

Thanks for anyhelp. Karl
PS: using IE 6.0 +



karl@laketahoegymnasticscamp.com

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 03-16-2003 23:24 Edit Quote

It looks like you have your syntax right and everything. 10 bucks says Internet Explorer simply doesn't support it.

Perhaps you could achieve the same effect by using @media print { body { margin:1cm } }? Not sure if that would have the same effect in all situations.

Perfect Thunder
Paranoid (IV) Inmate

From: Milwaukee
Insane since: Oct 2001

IP logged posted posted 03-17-2003 18:24 Edit Quote

edit: Better yet, here's a more definitive source.

[This message has been edited by Perfect Thunder (edited 03-17-2003).]

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

IP logged posted posted 03-18-2003 01:12 Edit Quote

According to RichInStyle, almost none of the paged media attributes are supported in most of the older browsers. The table only shows support up to NN4, Mozilla 5, IE 5 and Op 3.6, so I'm not sure about the latest browsers. Most CSS support tables don't even bother showing paged media attributes, though, so I think it's pretty safe to say that the support is not very good (if there is any support at all).

Such is the gap between the ideal and reality that we must all struggle with... *sigh*

Perfect Thunder
Paranoid (IV) Inmate

From: Milwaukee
Insane since: Oct 2001

IP logged posted posted 03-18-2003 01:31 Edit Quote

CSS support info at WestCiv.com -- more up-to-date than the RichInStyle stuff.

brucew
Paranoid (IV) Inmate

From: North Coast of America
Insane since: Dec 2001

IP logged posted posted 03-18-2003 06:21 Edit Quote

It's really a confusion of terms that isn't defined fully in the CSS 2 Specification. @page does not mean "a piece of paper from a printer".

The only place I find a real definition of @page is in the W3C CSS Mobile Profile 1.0, http://www.w3.org/TR/css-mobile#section-selectors

quote:
@page "Defines a (optionally named) page formatting context"



So what? Well there are five paged media types: embossed, handheld, print, projection and TV. Think: media type = device.

@page rules by themselves to not tell the browser which of the five paged media types (devices) the rule applies to. It merely tells the browser to use the page box model instead of the usual box model and gives it some properties of that page box. In other words, a page formatting context.

It needs to be tied to a media type (device), in this case, media="print" in order for the browser to make sense of it. Therefore, you need a separate style block for the CSS that apply specifically to printed media, and your @page rule goes within it.

Or you can use Slime's method above within a style block for another media type (or within a media="all" block) to say, "Oh, by the way, use this rule instead when you print."

Suho1004
Maniac (V) Inmate

From: Seoul, Korea
Insane since: Apr 2002

IP logged posted posted 03-18-2003 07:34 Edit Quote

PT: Ah, yup--that's the one I was looking for. And that chart says that it's only supported in Opera 5(!).

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

IP logged posted posted 03-18-2003 14:23 Edit Quote

Karl: I'm wondering what you are trying to do? It may be that there is a simpler way of doing what you want. Why do you need such tight control over things? If that were the case you might want to think about using PDFs or something.

___________________
Emps

FAQs: Emperor

Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

IP logged posted posted 04-01-2003 21:43 Edit Quote

Emps:

Trying to get the most out of a piece of paper... trying to squeeze the margins down to their "mins". At my site (example link below) their are reports that a user can view online, and then an optional "printer friendly" (see "printer friendly" under mso tools on left) page to print from.
Hey, If I could create a PDF on the fly, that would be cool. I'm using XSLT to transform my data. Can you create a PDF on the fly using XSLT?

Karl

Example Link: http://www.meetscoresonline.com/results.asp?ax=9&meetid=10009&tm=Sunrays



karl@laketahoegymnasticscamp.com

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 04-01-2003 22:33 Edit Quote

I believe, if you transform into XSL:FO, there are programs that convert that into PDF files. I'm not sure what programs do it though, and XSL:FO is pretty complicated. You may want to just try to find a CSS workaround first.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu