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

Custom fonts are not picked in the generated PDF

SA-62497

Summary



When generating a PDF with custom fonts (for example, OTF and TTF) from an HTML rule, the custom fonts are not picked in the generated PDF. However, in the Rule preview, the custom fonts are fetched correctly.


Error Messages



Not Applicable


Steps to Reproduce

  1. Upload any font with TTF or OTF extension as a binary file in Pega using the webwb directory.
  2. Create an HTML rule.
  3. Refer the uploaded font using the fontface tag.
  4. Display text using Div or Font tags.

    <html>
    <head>
    <style>

    @font-face {
    font-family: GalanoGrotesqueRegular;
    src: url('GalanoGrotesqueRegular.otf?');
    }
    p {color:blue;font-family: GalanoGrotesqueRegular}
    </style>
    </head>
    <body>

    <p>GalanoGrotesqueRegular - Some text</p>

    </body>
    </html>

     
  5. Pass the generated HTML rule as a parameter along with the fonts directory to invoke the @baseclass HTMLTOPDF activity.
  6. Invoke the Call Code-Pega-PDF.View activity to view the generated PDF


Root Cause



Pega levarages PD4ML library for PDF generation. This is not supported by this library.
TTF fonts are supported.



Resolution



Perform the following local-change:

Follow the below pattern while providing a font-family name.
Provide the exact font -family name instead of the font file name. <html> 
<head> 
<style> 

p {color:red;font-family: "Lucida Calligraphy Italic"} 

</style> 
</head> 
<body> 

<p>Hello Lucida\ Calligraphy\ Italic</p

</body> 
</html>



 

Published October 2, 2018 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

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

Did you find this content helpful?

Want to help us improve this content?

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