|
Rank: Advanced Member Groups: Member
Joined: 5/14/2013 Posts: 45
|
When rendering a PDF for a huge page from UBS.com (http://www.ubs.com/global/en/about_ubs/media/global/releases.archive.html) we discovered an interesting issue:
The page takes around 30 seconds to be rendered (it's really big) which is fine. If we render the page in our environment it takes more than 3 minutes. After quite some extensive investigation we found our that the issue lies in the footer: Page {page_number}/{total_pages} | Version 1 | 2014-07-14 10:39 (UTC) If we remove the footer, then the page renders in 30 seconds. Adding it, it takes more than 3 minutes.
So we thought it will be the "total_pages" parameter (as you do only know the value at the end - so we thought you'll probably have to introduce it after having rendered the PDF for a first time). But interestingly it's not. The issue is caused by {page_number} instead. If we keep the entire footer, don't change anything in the options but just remove the {page_number} from the footer then the rendering drops from 3 minutes to 30 seconds. Reproducible every time.
So this is probably a bug in the EO library. You should easily be able to test that by: 1. Use {page_number} in the foorter 2. Use the Url pasted above 3. Create PDF using Html2Pdf
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
This is normal. When you set footer, the code will run the HTML converter again on each page just for the footer. This can slow down the conversion significantly since without header footer, the converter only run once; but with header/footer, it converter can run 1 + page_count * 2 times.
As an alternative, you can use the ACM interface (PDF creator) to create footer on each page. The ACM interface is specifically created for this purpose: it is much less powerful than the HTML to PDF interface but it is much faster. Because it is much less powerful, it requires much more code to generate complex output --- however it can be a good alternative for simple output such as header/footer. You can take a look of the PDF creator interface and sample to see how to use this feature.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 5/14/2013 Posts: 45
|
Hi,
thank you for your answer. I think you didn't read my post very well. To make things more clear: The problem ist not depending on whether there is a footer or not. The problem is only related to the {page_number} field.
So if we use the following footers: 1. "Page {page_number}/{total_pages} | Version 1 | 2014-07-14 10:39 (UTC)" 2. "Page {page_number} | Version 1 | 2014-07-14 10:39 (UTC)" 3. "Total {total_pages} pages | Version 1 | 2014-07-14 10:39 (UTC)" 4. "Version 1 | Capture date 2014-07-14 10:39 (UTC) | Print date 2014-07-16 14:33 (UTC)" Then we get the following render times: 1. 3 minutes 2. 3 minutes 3. 30 seconds 4. 30 seconds
We did extensive tests and anytime the {page_number} is there it takes excessively longer. As soon as we remove it, we do not have the issue anymore. And to make it clear: I'm just talking about the field not removing the footer itself. We have a footer in *all* tests.
This may make it a little bit clearer. You can reproduce by using the URL I provided and just rendering with a header above.
Best regards,
Simon
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
Sorry that we missed your key point in my previous reply. We have looked into the code. The reason that without the page number it renders a lot faster is because we only render the footer HTML once when the footer does not change. So in this case we run the converter twice (once for the main contents, once for the fixed page footer, then we just copy the same footer output to every page). However if the footer HTML changes for every page, then we have to re-run the converter for every page. In that case it will run 1 + page_count times.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 5/14/2013 Posts: 45
|
I see. Then we either have to use a "constant" footer or we manually create the PDF footer after the actual Html2PDF conversion using ACM. Thx and best regards, Simon
|
|