Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxPages Limit in MultiPage #1813

Open
NARIKODANHRIDUL opened this issue Jan 26, 2025 · 3 comments
Open

maxPages Limit in MultiPage #1813

NARIKODANHRIDUL opened this issue Jan 26, 2025 · 3 comments
Labels
needs triage support Asking for help writing an application

Comments

@NARIKODANHRIDUL
Copy link

I’m dynamically generating a PDF using an API, and I encountered an exception: TooManyPagesException. This happened when the number of pages exceeded the default value of 20 for maxPages. Increasing the maxPages value resolved the issue for now, but I’m wondering if there’s a way to set maxPages to unlimited or handle this more effectively.

Is there a proper approach to make maxPages dynamically adapt to the content or ensure it doesn’t impose a hard limit?

@NARIKODANHRIDUL NARIKODANHRIDUL added needs triage support Asking for help writing an application labels Jan 26, 2025
@maks
Copy link

maks commented Mar 8, 2025

Why not set it to maxPages: 0x7FFFFFFFFFFFFFFF, ? and then surely your process will exhaust all available memory well before it ever hits that limit.

@caylab
Copy link

caylab commented Mar 10, 2025

I’m wondering if there’s a way to set maxPages to unlimited or handle this more effectively.

This would be a bad idea as this exception is usually the "last resort" when other issues cause an infinite loop of creating pages.

A typical case for this is when a "non-spanning" widget is larger than the page. Usually, the library would then put that entire widget on the next page. But if the widget is bigger than the page, the library will try to do this indefinitely.

So to prevent this infinite loop, it makes sense to define an upper limit. And in almost all cases, there is a number of pages which is rediculess and at which it is safe to say that an issue is causing this.

I don't think there is a book with more than 99999 pages.

@maks
Copy link

maks commented Mar 10, 2025

@caylab unfortunately that seems not to be the case, as I reported in #1762 (comment) , using Multipage with a image that doesn't fit on a single page seems to cause just such an infinite loop irrespective of what the maxPages value is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage support Asking for help writing an application
Projects
None yet
Development

No branches or pull requests

3 participants