New issue
Advanced search Search tips

Issue 697079 link

Starred by 7 users

Issue metadata

Status: Duplicate
Merged: issue 320370
Owner: ----
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Chromium does not implement margin-boxes (correctly)

Reported by mart...@live.nl, Feb 28 2017

Issue description

Chrome Version       : 56.0.2924.87
URLs (if applicable) : N/A
Other browsers tested: N/A

Following https://www.w3.org/TR/css3-page/#margin-boxes the following margin-boxes should be implemented when converting html to pdf files: 

‘@top-left-corner’
‘@top-left’
‘@top-center’
‘@top-right’
‘@top-right-corner’
‘@right-top’
‘@right-middle’
‘@right-bottom’
‘@bottom-right-corner’
‘@bottom-right’
‘@bottom-center’
‘@bottom-left’
‘@bottom-left-corner’
‘@left-bottom’
‘@left-middle’
‘@left-top’ 

Currently, when setting the 'content' field, this is ignored when printing to pdf.

What steps will reproduce the problem?
1. Create a html document with the content:
<style>
@page {
  @top-center { content: "This text should be displayed" }
}
</style>
2.Open in chrome
3.Press "Ctrl+P" and select "Print as PDF"

What is the expected result? What happens instead?
The print-preview should show the text in content. It does not

Additional Info:
While searching I found a bit of commented out test-code referencing these margin-boxes. Including it for completeness https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/printing/page-rule-css-text.html?q=@page&dr=C&l=86

Moved from https://bugs.chromium.org/p/pdfium/issues/detail?id=673

Please provide any additional information below. Attach a screenshot if
possible.

 
Cc: thestig@chromium.org weili@chromium.org
Components: Internals>Plugins>PDF Internals>Skia>PDF
Labels: Needs-Feedback
a. Is the style tag the only thing needed in the HTML file to reproduce the problem? If not, can you attach a complete example?

b. Is this problem specific to "Print as PDF" or does it happen on real printers too?

c. What browser implements margin-boxes correctly?

Comment 3 by mart...@live.nl, Mar 1 2017

a. yes. If a more real world example is requested, see this article: https://www.smashingmagazine.com/2015/01/designing-for-print-with-css/#left-and-right-page-spreads

b. As I do not have a printer at hand, I am unable to test this.

c. Since converting html to pdf is a feature specifically implemented by chrome  (firefox, edge and IE do not have such a feature) no other browser does. 
On Windows an option exists to print via "Microsoft Print to PDF". This also does not implement the requested behaviour.
Project Member

Comment 4 by sheriffbot@chromium.org, Mar 1 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "thestig@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
a. Can you find or make a webpage that demonstrates the issue with margin-boxes, instead of an article that explains how to make webpages with margin-boxes?

b. That's ok.

c. Can you try {Firefox, Edge} with "Microsoft Print to PDF" and see if the produced PDF is correct?
Labels: Needs-Feedback

Comment 7 by weili@chromium.org, Mar 7 2017

Components: Blink>CSS
Labels: -Type-Bug Type-Feature
Status: Available (was: Unconfirmed)
I tried with IE, Firefox, and Safari, none of them seems support it.

Paged media module is still a working draft, not sure whether/how long it will be adopted.

Labels: Update-Quarterly

Comment 9 by mart...@live.nl, Mar 14 2017

I could have sworn I replied to this. Here are my answers.

a. The example I gave at the top of the report should be enough.
c. I can confirm to @weili that it does not work

I hope it gets implemented

Comment 10 by suzyh@chromium.org, Mar 27 2017

Labels: Objective
More or less the same as bug 368053 and bug 320370.

> What browser implements margin-boxes correctly?

AFAIK none does. There are a bunch of dedicated PDF generator tools which do, though; there is a good list here: https://www.print-css.rocks/tools.html

Comment 12 by weili@chromium.org, Jul 11 2017

Labels: -Needs-Feedback
Mergedinto: 320370
Status: Duplicate (was: Available)
This looks like a feature request for page margin box. Let's merge into bug 320370 to have a single place for tracking.

Sign in to add a comment