Skip to content

Conversation

@tsufiev
Copy link

@tsufiev tsufiev commented Oct 15, 2025

When generating PDF documents which

  1. are meant only for viewing from screen and
  2. at the same time contain a lot of pictures, infographics, etc which cannot be easily broken between pages of fixed height

it is very convenient to have pages of varying height.

The whole approach would work the following way:

  1. Set an initial page to be big enough to fit as many content as there possible can be on one page (say, format: [841.89 * 1.4, 3370.39 * 3])
  2. Continue calling html2pdf worker in a loop, rendering one page at a time.
  3. Once .toPdf() is invoked, it trims that huge fixed-height page to an actual content height.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant