Exporting multiple pages as PDF fails with certain options

Environment
Windows 10, Tomcat 9.0.62, MariaDB 10.11.2, XWiki 14.10.9

Description
An error occurs when exporting multiple pages as PDF using the PDF Export Application via the browser. If one of the table of contents, header or footer options is selected during export, the spinning wheel appears, but the PDF is not displayed in the browser and eventually a timeout occurs.

The following error can be seen in the paged.polyfill.js file:

VM1533 paged.polyfill.js:3715 Uncaught (in promise) Error: item doesn't belong to list
    at List$6.remove (VM1533 paged.polyfill.js:3715:20)
    at Following.onRule (VM1533 paged.polyfill.js:30756:14)
    at VM1533 paged.polyfill.js:372:26
    at Array.forEach (<anonymous>)
    at Hook.trigger (VM1533 paged.polyfill.js:371:15)
    at Object.enter (VM1533 paged.polyfill.js:26482:24)
    at Object.<anonymous> (VM1533 paged.polyfill.js:11272:17)
    at walkNode (VM1533 paged.polyfill.js:11426:35)
    at List$6.walkReducer (VM1533 paged.polyfill.js:11450:62)
    at List$6.reduce (VM1533 paged.polyfill.js:3453:19)

Apparently there is a log file for the export job in the folder /jobs/status/export/pdf//log.xml. However, the folder …/export does not exist. Not even after setting the log level of org.xwiki.export.pdf to DEBUG.

If the code is removed from e.g. the template footer, the PDF export works.

Which browser? Is the behaviour the same if you try a different browser? Have you tried increasing the “Page Ready Timeout” from the PDF Export Administration? See https://extensions.xwiki.org/xwiki/bin/view/Extension/PDF%20Export%20Application/#HAdministrationSection .

What folders do you have in <permanentDirectory>/jobs/status ? Are you sure you’re looking in the right permanent directory (e.g. in case you have multiple XWiki instances).

Are you using the default PDF template or a custom one?

This can be a bug / limitation in the library we’re using to layout the content for PDF printing but we can’t help you much if you don’t try to reduce the problem. You could for instance try to determine which wiki page triggers the issue by excluding pages from the export (try to export fewer pages until the problem doesn’t reproduce). Then you could try to determine which part of the content triggers the issue by removing some parts of the content.

Of course, if the content you have is public you can also make a XAR export and give it to us so that we can try to reproduce the issue.

Hope this helps,
Marius

Hello Marius,

many thanks for the quick response.

I tested with Chrome, Edge and Firefox. Same error in all browsers.

Also changed “Page Ready Timeout”, no difference.

I actually looked for the log file in the wrong permanent directory. Thanks for the hint. There is no difference in the log files of a failed export and a working export.

The error occurs both with the default template and with a custom template.

As already written, the error is related to the export options.
The export without table of contents, header and footer works without problems. The error only occurs when selecting one of these options.

I’ve also tried exporting just one page and pages with no content, both to no avail.

More hints welcome,

Markus

Are you saying that you get the timeout even when you export a single empty wiki page with the default PDF template and the default options (cover, toc, header, footer enabled)? I find this surprising, as we have automated tests that would have caught this issue.

BTW, do you have a custom skin / color theme?

With option cover the export is working. Toc, header and footer are causing problems. Even with a single empty page.

Skin and color theme both custom.

Then I suspect some CSS from the skin / color theme is breaking the CSS used for the PDF table of contents / header / footer, but it’s hard to tell what exactly. You could try to export with the default color theme (and the custom skin) to see if the issue comes from the color theme, or with the default skin and your custom color theme, to try to reduce the search space.

Thank you very much Marius,

it was due to a CSS directive for the table layout in the advanced variable of the color theme.
Now the pdf export is working with all options.

1 Like