rspace-os / rspace-web

This the main repository for RSpace: rspace-web. Check https://github.com/rspace-os/rspace-web/blob/main/DevDocs/DeveloperNotes/GettingStarted/GettingStarted.md for setup instructions.
https://github.com/rspace-os/rspace-web/wiki
GNU Affero General Public License v3.0
15 stars 3 forks source link

RSDEV-411: a few fixes for pdf export, most importantly allow docs to have & (ampersand) in the name #184

Closed mKowalski256 closed 2 weeks ago

mKowalski256 commented 2 weeks ago

Turns out that introducing a new pdf-printing library (flying-saucer-pdf) caused a problem with exporting some ELN documents to PDF. The problem was caused by & (ampersand) character that RSpace may try to put into PDF page header (or footer) as a part of document name, or (less likely) as a part of full name of the exporting user. Attempt to export a document that has & in the name was resulting in an error like:

Can't load the XML resource (using TrAX transformer). org.xml.sax.SAXParseException; lineNumber: 19; 
columnNumber: 67; The reference to entity "in..." must end with the ';' delimiter..

After investigating, it seems that flying-saucer-pdf has a problem with interpreting html entities/chars passed through CSS 'content' attribute, which was how the header/footer generation was done. The fix applied in this PR is to use running CSS headers/footers, which allows to define content of header/footer through html fragment in '' section, rather than CSS attribute in '