Skip to main content
christopher_4039
Participant
February 19, 2026
Question

Performance Issues Dynamically Adding Pages to PDF via JavaScript

  • February 19, 2026
  • 1 reply
  • 0 views

Hello Adobe Community,

 

My team is currently developing a highly dynamic PDF in Acrobat Pro to replace a legacy XFA-based form that has been in production for approximately 10 years. Conceptually, the form is similar to a complex tax document: it contains numerous questions with varying response types (strings, integers, dates, etc.) and performs extensive cross-field validation and data integrity checks.

Because XFA is deprecated, we are rebuilding the logic using Acrobat JavaScript.

 

Core Requirements:

  • The PDF must function fully offline (no web dependencies).

  • All features must work in Adobe Acrobat Reader (not just Acrobat Pro).

 

Current Architecture:

A typical page in the form contains:

  • 20–30 user input fields (text, numeric, date/time, etc.)

  • 100–200 button overlays

    • For certain multi-select scenarios, users can either:

      • Manually enter a numeric value into a field, or

      • Click a corresponding attribute button that auto-populates the value

  • (Not implemented) JavaScript performing cross-field validation and data integrity checks

 

Performance Issues:

We are encountering significant performance degradation when dynamically generating new pages. In some cases, it takes 30+ seconds to spawn a single new page. This is especially concerning given that we are still early in development and expect the form complexity to increase. We have found the main culprit to be the large number of button overlays, but removing them does not fully resolve the performance issues.

Page generation is handled using template spawning. A simplified example is shown below:

 
var myTemplate = this.getTemplate("MyTemplate");

myTemplate.spawn({
nPage: this.numPages,
bRename: true,
bOverlay: false
});

 

Key Concern:

Given the current latency just to generate pages, we are concerned about long-term scalability and user experience once the form is fully implemented.

 

Questions for Adobe Community:

  • Are there known performance limitations when spawning templates with a high volume of fields and button objects?

  • Are there best practices for reducing page generation time in dynamic, JavaScript-heavy forms?

  • Would consolidating button overlays into fewer interactive elements meaningfully improve performance?

  • Are there recommended architectural patterns for large offline Reader-compatible forms?

Any guidance, performance optimization strategies, or relevant documentation would be greatly appreciated.

 

Thank you,
Chris

 

    1 reply

    try67
    Community Expert
    Community Expert
    February 19, 2026

    My recommendations:

    • Use the oXObject parameter of the spawn method. This can greatly improve the speed when spawning multiple pages. The documentation explains how to do it
    • Disable calculations in the file before spawning, and re-enable them afterwards. This can be done by setting this.calculate to false, and then to true.