danfickle / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!
https://danfickle.github.io/pdf-templates/index.html
Other
1.93k stars 360 forks source link

Image SRC URL with parameters fails #849

Open davidalgersr opened 2 years ago

davidalgersr commented 2 years ago

A HTML document with an IMG tag will fail if the URL of the image SRC attribute has multiple parameters.

Example: <img alt="" src="https://myserver/media/conr?cmd=file&target=A_s46D32PzAKrb966DQ_Srpno64JN4QUYRb5oe6cgzNzmHL1EckvrEhFw981_SbW0Ye_PwMhovvx5UYA_E_E&export=true&mmjwt=eyJGciOiJIUzI1NiJ9.eyJqdGkiMzZjNDY0YTY1YjYwZTlhZjBiN2QwYWQzZSIsImlhdCI6MTY1NjM3ODQ5MCwic3ViIjoiNjQwNDUwNyIsImlzcyI6IndlYmFzc2Vzc29yIic5MDkwfQ.mIp3XY_uoqwfUPwZGUIHR1W5r7djJppWliu-zKZ8B-c" style="width: 240px; height: 175px;" />

Relevant stack trace: Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException; lineNumber: 61; columnNumber: 147; The reference to entity "target" must end with the ';' delimiter. at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:469) at com.openhtmltopdf.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:251) at com.openhtmltopdf.resource.XMLResource$XMLResourceBuilder.access$100(XMLResource.java:145) at com.openhtmltopdf.resource.XMLResource.load(XMLResource.java:71)