HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › Troubleshooting › Problem when creating the PDF with Korean characters

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26439

    Hi,
    Following the guide as in pd4ml-html-css-pdf-tips-tricks-f7/ttf-embedding-t42.html,
    I converted the Korean HTML test string to PDF using PD4ML. By the way, the output had question marks with not properly converted.
    The character set was UTF-8.
    I performed as follows:

    1. Inserted ttf font files in the created folder “/fonts” under /WEB-INF/lib/.
    2. Run java -jar pd4ml_demo.jar -configure.fonts /fonts. Then pd4font.properties was created.
    3. In my JSP file, I entered like this:

    <pd4ml:usettf from="/fonts"  />
    
    <font face="Batang">테스트</font><br>
    <font face="Dotum">헬로우</font>

    It was not executable so I zipped the fonts folder into jar, placed it in the lib folder, and entered as follows:
    <pd4ml:usettf from="java:fonts" serif="Dotum" sansserif="Dotum" monospace="Dotum" />

    I run it again, the output was not proper.

    #28175

    <pd4ml:usettf from="java:fonts" serif="Dotum" sansserif="Dotum" monospace="Dotum" /> assumes the fonts are in fonts/ directory of the JAR. If the JAR has no internal directory structure, try <pd4ml:usettf from="java:" serif="Dotum" sansserif="Dotum" monospace="Dotum" />

    But I would recommend to start from a creation of a font directory not relative to /WEB-INF/lib (it does not work that way), but absolute to the file system. defug=”true” of <pd4ml:transform> should help you to identify the font loading problems.

    #28176

    I am following your order, but the same problem happened.
    I am in a hurry. If this tool is ok, I wanna purchase it.
    Please help me.
    For reference, my code is as follows:

    <%@ taglib uri="/WEB-INF/tlds/pd4ml.tld" prefix="pd4ml" %>
    <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
    
    <pd4ml:transform
    screenWidth="400"
    pageFormat="A4"
    pageOrientation="portrait"
    pageInsets="15,15,15,15,mm"
    inline="true"
    debug="true"
    >
    <!--
    TODO:
    1. adjust fonts directory below.
    2. make sure that the directory contains pd4fonts.properties file
    3. for more info see PD4ML.useTTF( String, boolean ) Java API docs
    -->
    <pd4ml:usettf from="c:fonts" serif="Dotum" sansserif="Dotum" monospace="Dotum" />
    <html>
    <head>
    <title>PD4ML embedded fonts test</title>
    <META http-equiv=Content-Type content="text/html; charset=UTF-8">
    <title>title</title>
    
    <pd4ml:header areaHeight="50">
    <font face="Arial" size="2">Header test.<br>
    ($[page]) of (총 $[total])</font>
    </pd4ml:header>
    
    </head>
    <body>
    <font face="Arial" >Hello, World!</font><br>
    <font face="Times New Roman" size="4">Hello, World!</font><br>
    <font face="Arial Bold">Hello, World!</font><br>
    <font face="Dotum">테스트</font><br>
    <font face="Batang">헬로우</font><br>
    <TABLE border="0" cellpadding="0" cellspacing="0" class="list_common" style="margin-right:-18px" id=tbl>
    <TR>
    <TD>aaa</TD>
    <TD>bbb</TD>
    <TD>ccc</TD>
    </TR>
    <TR>
    <TD>111</TD>
    <TD>222</TD>
    <TD>333</TD>
    </TR>
    </TABLE>
    </body>
    </html>
    </pd4ml:transform>

    #28177

    what does it output to server’s log?

    #28178

    Thanks.
    I found the error reason. Actually, I copied the font directory but now I regenerated the font file, compiled it, and it looks fine.

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Troubleshooting’ is closed to new topics and replies.