title: HTML/JS Rich Text Editor Pagination
body: <p>I'm looking on how to implement pagination/page breaks with page formats (A4, letter, etc.) using a rich text editor (like <a href="https://github.com/yabwe/medium-editor" rel="noreferrer">the Medium Editor</a>).</p>
  
  <p>The font family, font size, line height, margins are going to be fixed, as this is a very specific case study. I'm thinking of handling zoom levels in pure CSS (scale), instead of directly modifying widths, heights, etc.</p>
  
  <p>Also, for the sake of the experiment, say I'll be running this in Chrome only &amp; browser rendering differences aren't really an issue (but even if I were building this for various browsers, I'd try and use more precise units, such as "px", "em" for the font-sizes, page widths, margins between elements, etc. - probably just "px").</p>
  
  <p>Keep in mind I'm not asking about "@page" rules or print rules, I know how to achieve what I want with those when I print out a PDF, but rather direct in-browser implementation. Printing should (and will) be handled by "@page" and I got no issue to handle page breaks there when I need them.</p>
  
  <p>In the end, my question is - where do I start?</p>
  
  <p>I imagine taking into account word-count and "h(1,2,3...)", "p" tag margins, along with case-specific CSS rules (break-after, break-word, break-line, etc) - even though taking those into account with js probably won't be very easy.</p>
  
  <p>Probably even include the page height? Say, if the format is A4: 596px x 842px (72dpi) - take it into account when the total height of "each" element inside the page == height of page - [sum of bottom and top page margins]?</p>
  
  <p>Other than the latter (with a simple js loop), if someone has any pointers, or maybe even a code snippet (or a plugin?), I'd be very grateful! Thank you!</p>