Details
-
Bug
-
Resolution: Fixed
-
Major
-
16.4.6
-
None
-
Chrome
-
Integration
-
High
-
Medium
-
N/A
-
N/A
-
Description
Steps to reproduce:
- create a wiki page with this content:
first page (% class="break-before-page" %) second [[image:Sandbox.WebHome@XWikiLogo.png||loading="lazy" width="16"]] page
- add a stylesheet extension with this content:
.break-before-page { break-before: page; }
- mark the added SSX as loaded "On this page or on demand".
- export the created wiki page to PDF using Chrome (either your own browser or a headless instance)
Expected: the page is exported to PDF
Actual: the PDF export times out
Notes:
- the stylesheet is needed just to simulate multiple print pages
- the following conditions are all required to reproduce the issue:
- use Chrome
- the image has to be on the second or any of the following print pages
- the image has to be lazy loaded
- the image dimention has to be specified (width or height or both)
Explanation:
- HTML images support the loading attribute whose "lazy" value tells the browser to defer the image loading until the image is scrolled into view. This means that such images will have the complete property set to false until the image gets into view port. And of course the load event is not going to be fired sooner than that.
- when a wiki page is exported to PDF, paged.js, the library we used to split the content into print pages, has to wait for images to be loaded in order to know if they fit the current print page or have to be moved to the next print page.
- Chrome doesn't fire the load event for lazy loaded images with specified dimensions until they are scrolled into view
- if such an image is not on the first print page then the load event is never fired (the image is not loaded) so paged.js waits until the timeout is reached.