Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26356

    I am trying to render an HTML document with Chinese characters into a PDF and it either inserts ??? for the missing characters or it totally ignores them.

    In my logs I see this:
    <br /> ENCODING=UTF8<br /> version: PD4ML 351 Pro<br /> not yet in cache: file:C:DEVworkspaceECLIPSEportalweb-colotargetworkwebappWEB-INFclassescomxxxxxxxxportalrenderdocument/pd4fonts.properties<br /> not yet in cache: file:C:DEVworkspaceECLIPSEportalweb-colotargetworkwebappWEB-INFclassescomxxxxxxxportalrenderdocument/xxxx-propu.ttf<br /> read 'xxxx proportional unicode' from file:C:DEVworkspaceECLIPSEportalweb-colotargetworkwebappWEB-INFclassescomxxxxxxxxportalrenderdocument/xxxx-propu.ttf<br /> 'xxxx proportional unicode bold' is not in pd4fonts.properties file<br /> reject TTF lookup for: 'xxxx proportional unicode bold'<br /> 'times' is not in pd4fonts.properties file<br /> reject TTF lookup for: 'times'<br /> 'times new roman' is not in pd4fonts.properties file<br /> reject TTF lookup for: 'times new roman'<br /> 'akzidenzgroteskbe-bold' is not in pd4fonts.properties file<br /> reject TTF lookup for: 'akzidenzgroteskbe-bold'<br /> done in 500ms.<br />

    This is the code that I believe is relevant:
    <br /> String pathToPd4fontsProps = "/com/xxxx/xxxx/portal/render/document/pd4fonts.properties";<br /> URL fontPathURL = PD4MLDocumentRenderer.class.getResource( pathToPd4fontsProps );<br /> File fileP = new File(fontPathURL.toURI());<br /> fontPath = fileP.getParent();<br />
    Later on in the same method I have this code:
    <br /> pd4ml.enableDebugInfo();<br /> pd4ml.useTTF( fontPath, true );<br />
    I followed the documents on this site to generate my pd4browser.properties, which is located in the same directory as the fonts and contains the following:
    <br /> #<br /> #Wed Mar 24 07:21:32 EDT 2010<br /> adobe.font.metrics=true<br /> debug.info.enable=false<br /> document.author=<br /> document.title=<br /> footer.color=#000000<br /> footer.font.face=Courier New<br /> footer.font.size=10<br /> footer.font.style=0<br /> footer.height=12<br /> footer.init.page.num=1<br /> footer.page.num.align=right<br /> footer.page.num.template=null<br /> footer.pages.to.skip=0<br /> footer.title.align=center<br /> footer.title.template=null<br /> header.color=#000000<br /> header.font.face=Courier New<br /> header.font.size=10<br /> header.font.style=0<br /> header.height=12<br /> header.init.page.num=1<br /> header.page.num.align=right<br /> header.page.num.template=null<br /> header.pages.to.skip=0<br /> header.title.align=center<br /> header.title.template=null<br /> images.interpolate=false<br /> insets.bottom=10<br /> insets.left=10<br /> insets.right=10<br /> insets.top=10<br /> insets.units=mm<br /> page.bookmarks.destinations=false<br /> page.bookmarks.headings=false<br /> page.format=A4<br /> page.hyperlinks=true<br /> page.orientation=false<br /> pdf.forms.enable=false<br /> proxy.host=<br /> proxy.port=0<br /> rendering.patch=true<br /> rendering.split=true<br /> table.breaks.enable=false<br /> ttf.fonts.default.monospace=<br /> ttf.fonts.default.sansserif=<br /> ttf.fonts.default.serif=<br /> ttf.fonts.dir=com/xxxx/xxxx/portal/render/document<br /> userSpace.adjustToContent=false<br /> userSpace.width=800<br /> viewer.executeble=acroread.exe<br /> viewer.params=<br /> window.height=100<br /> window.width=100<br /> window.x=850<br /> window.y=600<br />
    Finally, my pd4fonts.properties file is located in the same directory as the fonts and pd4browser.properties and it contains the following:
    <br /> #this is an autogenerated file. please remove manually any references to copyrighted fonts<br /> #Wed Mar 24 07:21:32 EDT 2010<br /> KaiTi_GB2312=SIMKAI.TTF<br /> xxxx Fixed 2 Unicode=xxxx-fixed2U.ttf<br /> xxxx Fixed Unicode=xxxx-fixedu.ttf<br /> xxxx Fixed Unicode B=xxxx-FixedU_B.ttf<br /> xxxx Fixed Unicode C=xxxx-FixedU_C.ttf<br /> xxxx Fixed Unicode D=xxxx-FixedU_D.ttf<br /> xxxx Fixed Unicode F=xxxx-FixedU_F.ttf<br /> xxxx Prop Unicode B=xxxx-PropU_B.ttf<br /> xxxx Prop Unicode C=xxxx-PropU_C.ttf<br /> xxxx Prop Unicode D=xxxx-PropU_D.ttf<br /> xxxx Prop Unicode F=xxxx-PropU_F.ttf<br /> xxxx Proportional Unicode=xxxx-propu.ttf<br />

    You see that I have a mention of the Chinese font “KaiTi_GB2312=SIMKAI.TTF” but obviously it never is even mentioned. What am I doing wrong?
    My PDFs do get rendered but either with question marks or with the Chinese characters totally omitted. Please help.

    Thank you,
    Ty

    P.S. If you’re just going to send me to the same link TTF embedding link, it isn’t working. I have pored over that document. (pd4ml-html-css-pdf-tips-tricks-f7/ttf-embedding-t42.html) and it does not work! There must be some missing step. Is it necessary to register the Fonts with the OS? (Tried that, no difference.) I have been trying to get the TTF fonts that you included in the example but I have yet to see them getting picked up.

    #27927

    In order to use a font, registered in the .properties file as
    xxxx Fixed 2 Unicode=xxxx-fixed2U.ttf
    you need to explicitly specify the font face as it appears in pd4fonts.properties file:

    Text (or the same via CSS)

    On practice it would be more convenient to rename the bulky font face names in pd4fonts.properties, for example:
    <br /> xxxx=xxxx-fixedu.ttf<br /> xxxx Bold=xxxx-FixedU_B.ttf<br />

    For bold style
    Text
    It will look for font face with ” Bold” appended. (” Italic” for italic)

    Important:
    1. TTF embedding is a feature of PD4ML Pro (not Std)
    2. TTF font file should define glyphs, used in the text

    #27928

    Thank you for your reply.

    I did end up getting this to work only by using the ‘setDefaultTTF()’ method.

    (Incidentally, it is really non-intuitive the way the other alternative–embedding them in a JAR–expects that it look for a directory within the jar. I would have expected that notation to be the name of the jar. In any case, I did not use that method because of that ambiguity.)

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

The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.