Skip to content
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

Option for page breaks while printing #1190

Closed
bamhm182 opened this issue Apr 14, 2020 · 6 comments
Closed

Option for page breaks while printing #1190

bamhm182 opened this issue Apr 14, 2020 · 6 comments
Labels
A-Print Area: The "printed" page

Comments

@bamhm182
Copy link

bamhm182 commented Apr 14, 2020

What is Happening

When printing, multiple chapters can print on one page. This makes it a little difficult to find the beginning of new chapters as in some cases, the chapter may start at the bottom of a page.

no_breaks.pdf

What is Expected

As in real printed books, when a book is printed, the start of a new chapter means the start of a new page.

breaks.pdf

Proposed Resolution

The code <p style="page-break-before: always"/> can be added to the end of every chapter while on the print.html page in order to allow for the next chapter to be printed on a new page.

I realize this may not be ideal for all cases, so I also propose an option like [page-break-between-chapters] = true be available in the book.toml

@ehuss ehuss added the A-Print Area: The "printed" page label Apr 22, 2020
@morberg
Copy link

morberg commented Aug 16, 2020

As a temporary workaround I've added:

h1 {
    page-break-before: always;
}

to print.css.

@Kinrany
Copy link

Kinrany commented May 27, 2021

Is there a way to revert this? For a "book" with small chapters it's better to print on the same page.

I looked at the theme files, but the only mention of page-break-before is in highlight.js.

@ehuss
Copy link
Contributor

ehuss commented May 29, 2021

Sure, I think that can be added. I'm a bit surprised that is something that would be desired, but if you'd like, you can post a PR that reverts 0eb23ef to add the option back in.

@Kinrany
Copy link

Kinrany commented May 29, 2021

My use case is using mdbook as lazy way to have a personal webpage and a CV in one 🙂

@dmorawetz
Copy link
Contributor

Sure, I think that can be added. I'm a bit surprised that is something that would be desired, but if you'd like, you can post a PR that reverts 0eb23ef to add the option back in.

@ehuss I posted a PR to revert the change, #1728. Can you please have a look?

@ehuss
Copy link
Contributor

ehuss commented Nov 21, 2022

Closing as I believe this is resolved by #1728.

@ehuss ehuss closed this as completed Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Print Area: The "printed" page
Projects
None yet
Development

No branches or pull requests

5 participants