This issue has been created
There are 4 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-8cec9ced-79f3-4861-9d51-3eb2033d37bc XWIKI-24808 In Progress

The Live Data is not always rendered in the PDF export

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-92178e09-9e4f-4e9d-ab0c-deb3b56a3bfe Marius Dumitru Florea created this issue on 04/Sep/26 14:54
 
Summary: The Live Data is not always rendered in the PDF export
Issue Type: cid:jira-generated-image-avatar-8cec9ced-79f3-4861-9d51-3eb2033d37bc Bug
Affects Versions: 18.7.0
Assignee: Unassigned
Components: Live Data
Created: 04/Sep/26 14:54
Priority: cid:jira-generated-image-static-major-b17ba018-1e7b-4d80-91d7-7476582562f0 Major
Reporter: Marius Dumitru Florea
Description:

Create a new page with a Live Data macro call. I used the first example from https://extensions.xwiki.org/xwiki/bin/view/Extension/Live%20Data%20Macro/#HUsage . Export the page to PDF.

Expected: the live data is rendered in the generated PDF, as it was in view mode
Actual: when performing the export with the user's own browser, the live data is rendered most of the time but once in 5-10 repetitions we see just the spinning wheel. When using the headless Chrome Docker container, the live data is almost never rendered. We just see the loading animation.

This smells very much like a race condition. The print preview page is printed to PDF once it's ready (window is loaded, all resources / images are loaded, initial async requests have complete). We know it's ready based on the PageReady module, which does some automatic checks (e.g. by hacking into XMLHttpRequet and fetch), but not every "page load delay" case can be detected automatically. In some case we need to manually delay the page ready.

My feeling that in this case, for live data, we need to manually delay the page ready until the live data fully loaded and rendered (its data is fetched and displayed).

 
 

4 updates

 
cid:jira-generated-image-avatar-92178e09-9e4f-4e9d-ab0c-deb3b56a3bfe Changes by Marius Dumitru Florea on 04/Sep/26 14:55
 
Fix Version: 18.8.0-rc-1
Description: Create a new page with a Live Data macro call. I used the first example from https://extensions.xwiki.org/xwiki/bin/view/Extension/Live%20Data%20Macro/#HUsage . Export the page to PDF.

{noformat}
{{liveData
  id="recentPages"
  properties="doc.title,doc.location,doc.author,doc.date"
  source="liveTable"
  sourceParameters="translationPrefix=platform.index."
  sort="doc.date:desc"
  limit="5"
/}}
{noformat}

*Expected*: the live data is rendered in the generated PDF, as it was in view mode
*Actual*: when performing the export with the user's own browser, the live data is rendered most of the time but once in 5-10 repetitions we see just the spinning wheel. When using the headless Chrome Docker container, the live data is almost never rendered. We just see the loading animation.

This smells very much like a race condition. The print preview page is printed to PDF once it's ready (window is loaded, all resources / images are loaded, initial async requests have complete). We know it's ready based on the PageReady module, which does some automatic checks (e.g. by hacking into {{XMLHttpRequet}} and {{fetch}}), but not every "page load delay" case can be detected automatically. In some case we need to manually delay the page ready.

My feeling that in this case, for live data, we need to manually delay the page ready until the live data fully loaded and rendered (its data is fetched and displayed).
Assignee: Marius Dumitru Florea
Status: Open In Progress
 
 

1 comment

 
cid:jira-generated-image-avatar-92178e09-9e4f-4e9d-ab0c-deb3b56a3bfe Marius Dumitru Florea on 04/Sep/26 14:59
 

Note that if I modify XWiki.PDFExport.Sheet to way 3 seconds more before printing, using:

pageReady.delayPageReady(new Promise(resolve => {
  setTimeout(resolve, 3000);
}), 'Test');

then the live data is fully rendered in PDF export, even with headless Chrome. This indicates the problem is indeed that we print to PDF before the live data is ready.