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.

Timur Sufiev added 4 commits October 15, 2025 16:30
Old mechanism of putting hyperlinks to various pages based on
link coordinates and first page height didn't work for the case when
pages are added to PDF document programmatically by a client
app. Allow to pass a new format of `enableLinks` which tells the
hyperlinks plugin in which container should the links be searched
in and to which page they should be put.
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