l1xnan / obsidian-better-export-pdf

Obsidian PDF export enhancement plugin
MIT License
364 stars 22 forks source link

[feature request] Page Break Control #325

Closed midstreeeam closed 2 months ago

midstreeeam commented 2 months ago

Hi, thanks for the awesome plugin! I’ve been using it for a while, but I’ve found it challenging to control where the page breaks occur during export. The export preview doesn't currently indicate where a new page will start, making it difficult to manage page layout.

It would be very helpful if there were a way to manually control where a new page begins. For example, adding a keyword or option to insert a page break at specific points in the content (e.g., before a custom html tag) would be great.

In my specific use case, I’d love to be able to automatically start a new page at each <h2> tag. Thank you for considering this feature!

midstreeeam commented 2 months ago

Nevermind, just found out that I can add <div style="page-break-after: always;"></div> easily to break the page. 吃了文化的亏

NaeemBolchhi commented 1 month ago
@media print {
  hr {
      break-after: page;
      visibility: hidden;
  }
}

We can use this as a snippet to use horizontal lines as page breaks. This way, there's no need for html code in the document. The three dash --- horizontal rule becomes a page break when saving the pdf.

BigChickenLegs commented 3 weeks ago

Is it possible to add settings or manual operation to control paging for each part when using ToC for multi-file export?