HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › pdf generation performance issue › Re: Re: pdf generation performance issue
A conversion duration primarily depends on HTML/CSS file size and its structure. So an HTML sample would help to analyze the issue in details.
Typical reasons of such performance issues:
– Huge CSS stylesheet: as we seen a couple of times, some “web optimised” HTML documents may include 2-3 Mb CSS style, tuned to suppress known banner exchange engines. The style makes no sense for HTML document layout, but makes CSS parser/runtime to spend quite a lot of resources to maintain the styles and it significantly slows down style resolving for a particular HTML element. Unfortunately CSS parser we use is not optimised to deal with extra big stylesheets.
– The entire document layout is built as a single table with tens or hundred thousands of cells. If the table is nested to another table – rendering takes 3 times longer; 2 levels of nesting – 9 times longer etc. For big documents we recommend to split a huge table to a sequence of smaller ones and avoid a table nesting.
If you are interested, a technical background of that is following: each cell width is calculated 3 times for MIN, MAX and optimal values. So every nesting level multiplies the “layouting” approaches to 3. If, lets say a content of a cell of a particular table row does not fit a column width calculated before, it needs to start table layouting again, taking into account a new condition.