Copy link to clipboard
Copied
The following cfdocument is not displaying the fonts.
<cfoutput>
<cfdocument format="pdf" fontembed="true">
<style>
body{font-family: 'SimSun' 'Microsoft Yahei'; font-size: 35px; }
td,th, h1,h2,h3, p{font-family:'Microsoft Yahei', sans-serif,Helvetica, Arial;}
</style>
<cfoutput>
<h1>PDF #chinese characters here#</h1> <!-- "PDF Example Title" in Chinese -->
</cfoutput>
</cfdocument>
</cfoutput>
===========================
AWS Linux 2023 EC2 instance
CF2023 Trial
Tried:
Adding fonts via CF Administrator
Adding fonts to /usr/share/fonts
Adding fonts to /usr/share/fonts/default/TrueType
Used in-built web server as well as apache
All suggestions welcome! Thank you.
Thanks everyone for the suggestions. I got help from our CF AWS partner who pointed out the missing piece as shown in bold below:
td,th, h1,h2,h3, p{font-family: 'SimSun', 'Microsoft Yahei', sans-serif,Helvetica, Arial;}
Copy link to clipboard
Copied
I don't know for sure what the cause of the problem is. But there are three things about your code that are questionable to me:
Therefore, improve your code as follows, and see if it helps:
<cfprocessingdirective pageencoding="utf-8">
<cfset chineseCharactersToBeTested="待测试的汉字。">
<cfdocument format="pdf" fontembed="true">
<style>
body{font-family: 'SimSun' 'Microsoft Yahei'; font-size: 35px; }
td,th, h1,h2,h3, p{font-family:'Microsoft Yahei', sans-serif,Helvetica, Arial;}
</style>
<h1><cfoutput>PDF #chineseCharactersToBeTested#</cfoutput></h1> <!--- "PDF Example Title" in Chinese --->
</cfdocument>
I have attached the PDF that results from my test.
Copy link to clipboard
Copied
Unfortunately the suggestions above didn't make a difference. We have tried both with and without the explicit UTF-8 encoding and without any cfoutput at all (as it is really not necessary if the characters are just added into the html directly). Thank you for your suggestions.
Copy link to clipboard
Copied
Thanks everyone for the suggestions. I got help from our CF AWS partner who pointed out the missing piece as shown in bold below:
td,th, h1,h2,h3, p{font-family: 'SimSun', 'Microsoft Yahei', sans-serif,Helvetica, Arial;}
Copy link to clipboard
Copied
@kalyan_SS , Thanks for sharing that.