I am having some issues rendering HTML content (both English And Japanese embedded with html- CMS content) in cfdocument
.
The fonts are coming up correctly, but they are being stretched (word wraps not working) and taking up extra space. Hence breaking the design in the pdf file.
I have tried using wrap, but as mentioned in this thread, I found that it operates on a string, not a fragment of HTML. So this will be an inappropriate tool for solving the issue.
I have also tried with CSS by putting the text within div tag, and applying the style width, word-wrap properties. But all above cases fails for me when used with <cfdocument format="pdf">
I have tried like below,
<cfprocessingdirective pageencoding="utf-8">
<cfset q ="英語からどれ早い中世イングランドで話され、現在世界で最も広く使用されている言語であるた西ゲルマン語です。[4]それは、英国を含むいくつかの主権国家、大多数の集団で第一言語として話されている、米国、カナダ、オーストラリア、アイルランド、ニュージーランド、カリブ海諸国の数"/>
<cfset r = "English is a West Germanic language that was first spoken in early medieval England and is now the most widely used language in the world.[4] It is spoken as a first language by the majority populations of several sovereign states, including the United Kingdom, the United States, Canada, Australia, Ireland, New Zealand and a number of Caribbean nations" />
<cfset test= q />
<cfset test1= r />
<cfdocument format="PDF" filename="./test.pdf" overwrite="Yes" fontEmbed = "yes">
<cfoutput>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PDF Export Example</title>
<style>
body { font-family: verdana; }
</style>
</head>
<body>
<h1>PDF Export Example Combined Japanese & English (html table structure td width 400px)</h1>
<br/>
<table border="1">
<tr>
<td style="width:400px;">#test#</td>
</tr>
</table>
<h1>PDF Export Example Combined Japanese & English (html div structure div width 400px)</h1>
<br/>
<div style="width:400px;">#test#</div>
<br/><br/><br/><br/>
<h1>PDF Export Example English (html table structure td width 400px)</h1>
<br/>
<table border="1">
<tr>
<td style="width:400px;">#test1#</td>
</tr>
</table>
<h1>PDF Export Example English (html div structure div width 400px)</h1>
<br/>
<div style="width:400px;">#test1#</div>
</body>
</html>
</cfoutput>
</cfdocument>
<cflocation url="./test.pdf" addtoken="false">
Please let me know if any more details are needed.