elliotblackburn / mdpdf

Markdown to PDF command line app with support for stylesheets
https://npmjs.com/package/mdpdf
Apache License 2.0
717 stars 47 forks source link

Feature request: page breaks #165

Closed ryan-williams closed 2 months ago

ryan-williams commented 10 months ago

It would be neat if some markdown, HTML, or CSS sentinel value could be interpreted by mdpdf as a "page break."

I love this tool, but often spend a lot of time futzing with CSS, or tweaking copy, to e.g. get a heading to flow to the next page (rather than dangling at the end of a page, with its content starting on the next page).

A couple options, off-hand:

ryan-williams commented 10 months ago

In the meantime, I'm using a spacer element like:

<div style="height: 10em"></div>

While debugging, a border is helpful:

<div style="height: 10em; border: 1px solid black"></div>
nuckle commented 8 months ago

You can do page breaks using this

<div style="page-break-before:always;"></div>
ryan-williams commented 2 months ago

I've referenced back to @nuckle's answer a few times in the last 6mos, it seems to work in general (not just with mdpdf) when saving web pages to PDF. Ty!