This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-ea6cdbe4-3b57-48cc-b34f-c1d8497a1c76 XWIKI-24539 Open

Paged.js named strings are serialized with unmatched quotes in PDF Export (string-set content(text))

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-52adae1d-81c9-40f4-8eeb-0767ced20151 James Wartell created this issue on 01/Jul/26 23:29
 
Summary: Paged.js named strings are serialized with unmatched quotes in PDF Export (string-set content(text))
Issue Type: cid:jira-generated-image-avatar-ea6cdbe4-3b57-48cc-b34f-c1d8497a1c76 Bug
Affects Versions: 17.2.0
Assignee: Unassigned
Components: Export - PDF
Created: 01/Jul/26 23:29
Priority: cid:jira-generated-image-static-major-ed0b1802-920c-4dd6-be5c-2d2f84f6a1a9 Major
Reporter: James Wartell
Description:

XWiki PDF Export depends on PagedJS 0.4.3.

<dependency>
  <groupId>org.webjars.npm</groupId>
  <artifactId>pagedjs</artifactId>
  <version>0.4.3</version>
</dependency>

Named string serialization is broken due to upstream Paged.js issue fixed by commit 60804ab but not present in any stable Paged.js release.

How this shows up in XWiki

If you set a StyleSheetExtension for CSS with on a pdf template with something like

@media print {
  h2 {
    string-set: stringsetdebug content(text);
  }
}

and a minimal page for testing

= Test Document =

== Section One ==

Some text.

== Section Two ==

Some more text. 

and then use a web debugger to inspect the style of elements on the pdf rendered output , you can see the mismatch quotes 

Actual: 

--pagedjs-string-first-stringsetdebug: "Section One;
--pagedjs-string-last-stringsetdebug: " Section Two;

Expected:

--pagedjs-string-first-stringsetdebug: "Section One";
--pagedjs-string-last-stringsetdebug: "Section Two";

I am seeing this on 17.2.0 on Windows but unless a mitigation is in place I'm not seeing, I expect it affects all versions that include PagedJS since the issue was introduced in 2020.

I see this relates to  XWIKI-23726, but because it causes specific bad behavior I thought it was worth it's own bug.

And yes, unfortunately I spent quite a while assuming the bug was in my own templates before tracing it down to the generated Paged.js output. ๐Ÿ˜… Maybe this will save someone else some trouble.