[css3-page] implement @page { size: portrait | landscape }

NEW
Unassigned

Status

()

Core
CSS Parsing and Computation
--
enhancement
5 years ago
7 days ago

People

(Reporter: teoli, Unassigned)

Tracking

(Blocks: 4 bugs, 4 keywords)

Trunk
css3, dev-doc-needed, DevAdvocacy, testcase
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [parity-webkit][DevRel:P3], URL)

(Reporter)

Description

5 years ago
CSS Paged Media Level 3 define the size attribute that allows to define the orientation of a page when printing it.

 @page{
     size:landscape;
 }

or (default value)

@page{
     size:portrait;
 }

I'm cc/ Brendan as I'm wondering if fixing this is necessary to fix some pdf.js bugs like bug 844090 .

Finally, it looks (but I weren't able to confirm/infirm it) that WebKit implement this property unprefixed.

Comment 1

5 years ago
(In reply to Jean-Yves Perrier [:teoli] from comment #0)

> 
> Finally, it looks (but I weren't able to confirm/infirm it) that WebKit
> implement this property unprefixed.

It is un-prefixed, at least on Chrome 27.0.1438.7 dev / OS X 10.8.3. 
(Note that, on OS X, it only works inside Chrome's own print-dialog. The OS X print dialog settings override it, tested both in Chrome and Webkit nightly. It is not unexpected - user setting)

Comment 2

5 years ago
Jean-Yves,

Consider these as suggestions.

1-
bug 137367 comment 8 suggests to set this kind of bug report's component field to Printing: Output and not Style System (CSS)

2-
You can expect some people to search for this bug with the string "@page" and/or with "size: landscape" (with a blank space separating the 2 words). CSS3 Paged Media may have better chances to be used for searching since the spec uses "Paged Media" and bug 286443 uses such terminology. And bug 286443 should definitely be a meta type of bug report.

So, I suggest the following as new summary:

[CSS3 Paged Media] Support for @page { size: landscape }


3-
Maybe add testcase-wanted keyword; I would.

Gérard

Comment 3

5 years ago
Are you only considering supporting 'landscape' and 'portrait'?

I'd love to enable native printing for Firefox in Google Docs (to print directly and not have to generate PDF server-side). But the lack of 'size' prevents that.

We set rules like size: 8.5in 11in; or pixel-sized rules, since we allow adjustment of page size and need precise control over how the page is printed. These values are specified for the property: http://www.w3.org/TR/css3-page/#page-size-prop

@philippe, the OS dialog doesn't respect the size property, although it's possible to use @media queries together with @page to target different page size targets. See: http://www.w3.org/TR/css3-page/#page-size-media-query

-Fil

Comment 4

5 years ago
> Are you only considering supporting 'landscape' and 'portrait'?

This bug 851441 report is only about supporting
@page {size: landscape }
where landscape is a reserved keyword.

> I'd love to enable native printing for Firefox in Google Docs (to print
> directly and not have to generate PDF server-side). But the lack of 'size'
> prevents that.
> 
> We set rules like size: 8.5in 11in; or pixel-sized rules, since we allow
> adjustment of page size and need precise control over how the page is
> printed. These values are specified for the property:
> http://www.w3.org/TR/css3-page/#page-size-prop

Fil, if you want to help, you can be helpful here: please create another bug report for this.

Give it the summary:

[CSS3 Paged Media] Support for @page { size: <page-size> } (eg. size: 4in 6in)

and make it blocking bug 286443 and Component field should be Printing: Output


How to Write a Proper Bug
https://quality.mozilla.org/docs/bugzilla/starter-kit/how-to-write-a-proper-bug/

Bug writing guidelines
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines


Gérard

Updated

5 years ago
Blocks: 862677

Comment 5

5 years ago
> please create another bug report for this.

Bug 851937: [CSS3 Paged Media] Support for @page size
has been created for this.

Comment 6

5 years ago
Does this block or depend on bug #851937?

Comment 7

5 years ago
Yes, I'd say this bug blocks bug 851937.
We created this bug 851441 because several people in another bug report (can't find which now) were strongly requesting support for @page {size: landscape }.
Blocks: 851937

Comment 8

5 years ago
> We created this bug 851441 because several people in another bug report
> (can't find which now) 

bug 115199 comment #141

> were strongly requesting support for @page {size:
> landscape }.
Duplicate of this bug: 306628
Duplicate of this bug: 915000

Comment 11

3 years ago
Any news about this issue guys? :)

Comment 12

3 years ago
Note that CSS.supports('size', 'landscape'); and @supports incorrectly reports support for the size property. CSS.supports('size', 'bogus') correctly returns false, so somehow Firefox's CSS parser recognizes this property. Why is the property parsed but not used?
It's not clear to me whether @page-specific properties like size should be handled by @supports and CSS.supports() even if we implemented support for them.  We currently parse and expose these properties on regular declarations, like |p { size: landscape; }| and again I'm not sure whether that's correct.  I've asked here about that:

  https://lists.w3.org/Archives/Public/www-style/2015Mar/0387.html

We have parsed marks, orphans, size and widows for a long time, without actual support for their behaviour.  I don't know why that is.
In the very early days of Gecko, all the properties in CSS 2 were added at the style system level.  The print-specific ones are the only ones that we haven't taken out.  (Basically everything that's CSS_PROP_BACKENDONLY, plus any @page stuff.)  We should fix it, but just never got around to it.
Keywords: DevAdvocacy
Summary: [CSS-Page Level 3]Implement the size: property (ability to define 'landscape' for printing) → [css3-page] implement @page { size: portrait | landscape }
No longer blocks: 1246805
Whiteboard: [parity-webkit] → [parity-webkit][DevRel:P2]

Updated

2 years ago
Flags: platform-rel?

Updated

2 years ago
platform-rel: --- → ?
Whiteboard: [parity-webkit][DevRel:P2] → [parity-webkit][DevRel:P3]
platform-rel: ? → ---

Updated

9 months ago
See Also: → bug 1363148

Comment 16

8 months ago
> Simple test:
> http://www.gtalbot.org/BugzillaSection/Bug1363148-page-size-landscape.html

Argh... got confused with bug number. Please use instead:

size: landscape
http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape.html


3 additional tests:

size: 4in 6in landscape
http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape-002.html

size: letter landscape
http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape-003.html

size: legal landscape
http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape-004.html

Chrome 58 does not pass Bug851441-page-size-landscape-002 but passes the other 3 tests.

Comment 17

8 months ago
I am removing page-size-landscape-002 (size: 4in 6in landscape) because it uses invalid syntax.

Value: 	<length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] 

means that portrait or landscape can only be added alongside of one of page-size reserved keywords.
You need to log in before you can comment on or make changes to this bug.