PDF Document Generation - Time out Issue

0
Hi;   I have integrated PDF Document Generation module to my app and managed to create simple test PDF. Afterwards, I created the real report page which has multiple datagrids, listviews, custom charts to display dynamic data. All of the tables / charts have datasources as microflows and complex retrivals are executed in the microflows. Since the page generation can not be completed in 30 seconds; I receive timeout errors on the PDF creation. In order to speed up the data retrivals; I implemented additional indexes to entities, changed some complex retrivals to OQLs etc which improved the performance but again page rendering can not be completed under 30 seconds. I even decided to break down the page in to multiple pages and create separate PDFs however a single page (which has a listview based complex data) can not be completed under 30 seconds.   I have increased the SyncTimeoutInSeconds constant from 30 to 300 however this didn't have any impact again I receive the following 30 seconds timeout error in the console:     Can you please help me how to overcome 30 seconds limitation for PDF creation?
asked
1 answers
0

RCA

  • The PDF module uses the Headless Chromium service to render HTML pages.

  • Rendering happens synchronously in a single web request thread.

  • Mendix Cloud and browsers both terminate HTTP requests that exceed ~30 seconds.So, your actual limit is a platform restriction, not a configurable one.

Preventive Actions :

 

1. Use asynchronous PDF generation

Instead of generating the PDF directly from a button action:

  • Run the PDF generation logic in a background task using:

    • Task Queue (recommended in Mendix 10+)

    • or Process Queue module

  • The flow:

    1. User clicks “Generate Report”

    2. You create a Task Queue job that runs your report logic.

    3. Show the user a message like “Report generation started. You will be notified when it’s ready.”

    4. When the PDF is ready, store it in the database and notify the user (via a page refresh, pop-up, or email).

This way, the browser request completes immediately, avoiding the 30-sec timeout.

2. Pre-aggregate or pre-cache data

Since your microflows perform complex data retrievals:

  • Create summary entities or cached tables with pre-calculated data.

  • Refresh these via scheduled events or background microflows.

  • The PDF generation then reads from these lightweight entities, not from slow queries.

3. Simplify the report UI

The HTML renderer loads all dynamic widgets (charts, listviews, etc.), which slows down rendering.To speed up:

  • Replace ListViews/Charts with static tables using Snippets that display data via simple data sources.

  • Avoid widgets that call client-side scripts (custom charts, JS widgets, etc.) — they slow Chromium rendering drastically.

  • Limit pagination — generate summaries, not full datasets.

4. Split report generation

If the report is too large:

  • Generate multiple smaller PDFs (per section or module).

  • Merge them afterward using the Community Commons → MergePDF Java action.

answered