PDF generated using pxCreatePDF contains garbled text for languages other than english

Hi,

We are using the Pega OOTB activity pxCreatePDF to convert our section into a PDF file. Though it works well for english language we noticed that the text is garbled for a chinese language user.

Please let us know how we can fix this. We are using Pega 8.4.6 version.

Thanks

Rajesh

@Rajesh N this question has been asked multiple times - a quick search on the forum under Related Contents should bring up:

this post

this post

this post (this gives a very clear explanation)

and

this post.

Can you confirm that you followed the documented steps?

Uploading custom font files

Customizing fonts for your Pega application

PD4ML supports unicode CJK (Chinese, Japanese, Korea) fonts, but they must be initialized as per our documentation.

You may be using an invalid font file. or the Font directory path is missing for params pyPDFFontsDirectory and pyPDFPropsDirectory.

To Overcome this Issue you need a Font directory path for params pyPDFFontsDirectory and pyPDFPropsDirectory.

For example:

  • Upload a working Simsun font file.
  • Set param.isClearCache true in the GeneratePDF activity right before calling HTMLToPDF
  • Include the @font-face in the paragraph rule:
<style type="text/css">

@font-face {

font-family: "simsun";

src: url("webwb/SimSun.ttf") format("truetype");

font-weight: bold;

font-weight: 700;

font-style: normal;

}

</style>

Please follow the steps listed in SA-5473. and in this Support Video.

@MarijeSchillern Thanks a lot for the reply. We are using Pega cloud so we need to contact support to update the settings. Will update once done.

I can see that ticket INC-228732 was logged and the final resolution was as follows:

The language fonts were not available in the fonts directory of the server.

Once added the below approaches resolved the issue :

  1. In order to support non-ascii characters for HTMLTOPDF conversion need to specify the JVM-WIDE setting ‘file.encoding’ property - and set this to ‘UTF-8’ which is -Dfile.encoding=UTF-8.

  2. Added the below in compact style sheet css file : examples for reference :
    @font-face {
    font-family: “MS Mincho”,Helvetica,Helvetica-Bold;
    src: url(“/fonts/NotoSansCJKjp-Regular.ttf”) format(“ttf”),
    url(“/fonts/NotoSansCJKjp-Regular.ttf”) format(“ttf”);

html,body {
font-family: “MS Mincho”,Helvetica,Helvetica-Bold;

Similar way need to include the font definition even for Chinese. With the above changes issue was fixed.