Who's up for a challenge? Break Bubble's Rich Text Editor content into A4-length pages

Hello all - hoping someone out there can help!

Background:
My app includes a report builder for my Users. A report consists of “pages”, the content for which is created by the User via Bubble’s Rich Text Editor. Users print their reports to PDFs and then send them to clients. Currently, I use a character count to indicate when the user may be getting close to the end of a page so they can manually create a new “page” and continue with their text. This is obviously not ideal for a number of reasons, which brings me to my question…

Question:
Can any one think of a way to “measure” the content of a Rich Text Editor - so we’re on the same page, this is more than just characters as a Rich Text Editor may include images of varying sizes, font of varying sizes, spaces, tabs, line breaks, etc.? I would then take this “measurement” and simply compare it to the equivalent measurement if the max width and height of an A4 page were reached by the content. Based on this comparison, I can establish where and when to start a new “page” for the client when I print the page to PDF.

Any feedback would be greatly appreciated! If this is impossible, I will have to consider re-architecting the entire “page” setup, which I really, really don’t want to do! :laughing:

If you need any more info to help address this challenge, just let me know.

Best,
Anthony