Support Article
HTML to PDF not converting Greek and Russian charactor properly
SA-6412
Summary
It was reported that when an end user uses the application to create a case for a consumer complaint, they, depending on certain conditions, fill up a survey. Once the survey is taken, it gets attached to the case and can be viewed as a pdf attachment. However, this survey is getting corrupted somehow and appears in the attachment with Unicode type characters.
Issue is applicable for the consumer country 'Greece'. For another country - Russia, the pdf form is blank.
Error Messages
No Error message
Steps to Reproduce
1. Write an activity to convert HTMLtoPDF
2. Pass html stream including sample Greece / Russia characters
3. View the generate pdf. The pdf file for the survey will show up with special characters similar to Unicode format (for Greece) and blank for Russia
Root Cause
The root cause of this problem is defect/misconfiguration in the PRPC operating environment. Following information was noted:
1. The database character set was found to be - NLS_CHARACTERSET-AL32UTF8 and the Server side encoding was found to be UTF-8.
2. No issues were found with HTMLtoPDF conversino.
When you create a simple / standalone html file (outside PRPC) with the given sample Greece / Russian characters - the reported issue is observed. However upon including the relevant fonts, the issue was no longer noticed.
Resolution
The solution was to add a step in the activity just before the call to the HTMLtoPdf activity to add the relevant fonts on the server. The following steps need to be followed:
- Before calling the HTMLtoPDF activity, set the parameters of the fontsDirectory path.
- PRPC should have access to the folder specified in the path .This is path to the server directory.
- For Unix and Windows env you can place fonts in java lib folder as specified in the example.
Note: For 6.x the path specified should not have double slash. - Keep the required fonts in the same folder.
-
- Need to add font-family in the css. All the fonts which you want to apply in your pdf should be placed in the same folder as specified in the activity.
- Below is an example of the HTML stream which has been tested locally to check how different fonts can be included in the same pdf. Fonts Included are English, Russian and Ukraine fonts.
- Input Stream
- Output PDF
-
- Input Stream
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.