Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Generated PDF file does not encode characters ('&') in link

SA-14491

Summary



PDF is generated using the out-of-the-box HTMLToPDF activity which invokes the generatePDF() method available in the public API. The PDF is supposed to contain links to certain documents stored in an external system.
Anchor tag contains "&" which changes to "&amp"; and the URL does not work.

For example: <A href="https://community.pega.com/www.pega.com%26a%3Da">Test Link</A>
Here www.pega.com&a=a is converted to www.pega.com&amp;a=a

Also the corr rule, if "&" is used, converts to "&" when the corr rule is saved.


Error Messages



Not Applicable


Steps to Reproduce



1. Create Correspondence rule which includes link in the anchor tag.
2. Pass this to the HTMLToPDF activity as an input.
3. View the PDF.


Root Cause



A defect or configuration issue in the operating environment.
The HTML stream is parsed by Tidy before being converted to a PDF, to ensure that it is formatted well enough for the pd4ml library to perform the conversion.
In the current configuration (defaults + XHTML format mode), Tidy will replace characters such as '&' with entities like "&amp".
There is currently no way to toggle Tidy or the character replacement.

Resolution



Perform the following local-change:

Disable HTML pre-processing by setting the pyHTMLDisableProcessing parameter for HTMLtoPDF to "true".

Suggest Edit

Published October 5, 2015 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us