Forum Bugs

PrinceXML malforming prince-bookmark-label when modifying inline style using Javascript

Dunnymeister
Build: Prince 10.7
Environment: Windows 10 (10.0.14393 Build 14393)

Description:
PrinceXML bookmark metadata attribute "prince-bookmark-label" included in inline CSS becomes malformed when modifying inline style attribute using external Javascript via command line.

Steps To Reproduce (example files and .bat to run attached below):
1) Include element in HTML with inline style containing valid "prince-bookmark-label"
2) Use the --script flag to include a JS file that modifies the elements inline style (e.g. modifies fontSize property)
3) Run

Current result: Bookmarks in resulting PDF are missing their labels
Expected result: Bookmarks in PDF should have labels as specified in the attribute defined in prince-bookmark-label.

Possible cause: The included files will output the style attribute's value to the command line when ran, both before and after modification. You can see that prince is modifying the "style" attribute, causing the prince-bookmark-label property to be ignored when generating bookmarks.

e.g.
Before increase
id = bookmark
style = prince-bookmark-level: 1; prince-bookmark-label: attr(title);
title = Goodbye, World!

After increase
id = bookmark
style = prince-bookmark-level:1;prince-bookmark-label:attr(attr(name("title")));font-size:112pt
title = Goodbye, World!
  1. JS_Style_Bug.zip1.6 kB
    Files to reproduce issue

Edited by Dunnymeister

Dunnymeister
I just realised that Prince 11 has been released so I tested with that as well and can confirm the issue persists.

One large difference: In Prince 11 a warning is thrown to indicate that the argument to "prince-bookmark-label" is malformed:

prince: test.xhtml:[style]:1: warning: bad argument to 'attr()' at 'attr('
mikeday
Thanks for the careful test case! This issue is caused by a bug in the style serialisation which we will fix for the next release.
Dunnymeister
Thanks Mike, do you know when the next release is scheduled for?
mikeday
We make latest builds available on a regular basis, typically every few weeks. We will update this thread when it is ready and you will receive an email from the forum.
mikeday
This bug is now fixed in the latest build, thanks again for letting us know. :)
Dunnymeister
Cheers Mike, works well :)