danfickle / danfickle/openhtmltopdf
Problem with page margins when using @page:first rule
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 423
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am trying to create a PDF file which has a kind of banner on the right side of the first page.
So i used the `@page`, `@page:first` and the `@right-top` rules to adjust the page margins and to insert the additional content:
```
@page {
size: A4 portrait;
margin: 10mm 5mm 15mm 20mm;
}
@page:first {
margin-right: 55mm;
@right-top {
padding: 1mm;
content: 'Some additional content\00000a@right-top\00000a(but only on the first page)';
white-space: pre;
vertical-align: top; text-align: left;
background: #ffeeee;
};
}
```
This works perfect for the first page, but on the follwing ones, the right margin defined in the `@page:first` rule is still used instead of the default value defined in the `@page` rule (by the way, similar effects arise when using the `@page:left` or `@page:right` rules).
For clarification please have a look at [Template.html.txt](https://github.com/danfickle/openhtmltopdf/files/1244710/Template.html.txt) and [Template.pdf](https://github.com/danfickle/openhtmltopdf/files/1244711/Template.pdf)
Thanks,
Bigdatha
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue with the attached Template.html.txt and compare the output with Template.pdf. Trace handling of the @page:first, @page:left, and @page:right rules, then verify that only the first page keeps its overridden right margin while later pages use the default @page margin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, java
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100