-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
White page added with @page named #233
Comments
Hi @Zefling, I hope this is better late than never. After looking at the code, it turns out there is logic to avoid this situation: if (page.getTop() == getAbsY()) {
pageBreakCount--;
if (pendingPageName && page == c.getRootLayer().getLastPage()) {
c.getRootLayer().removeLastPage();
c.setPageName(c.getPendingPageName());
c.getRootLayer().addPage(c);
}
} Basically, it says that if we are at the top of a page when we encounter a named page, remove the current page and replace it with the named page. Unfortunately, by default, the body has a top margin so we are not at the top of the page when we start the first element. We can fix this with: body {
margin-top: 0;
} This removes the empty first page. I think the workaround is simple enough that we can mark this issue as closed. I'll add a reference to this issue from the wiki. |
Thanks for this simple solution, we had found a much more complicated workaround. |
In this case, a blank page is added before the first styled page:
I tested several cases, the first page is necessarily
@page
unnamed.For generated content (for example, with mustache) where the first page would be present or not, it really complicated the implementation.The text was updated successfully, but these errors were encountered: