Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26355

    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:

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

    This is the code that I believe is relevant:

    String pathToPd4fontsProps = "/com/xxxx/xxxx/portal/render/document/pd4fonts.properties";
    URL fontPathURL            = PD4MLDocumentRenderer.class.getResource( pathToPd4fontsProps );
    File fileP                 = new File(fontPathURL.toURI());
    fontPath                   = fileP.getParent();

    Later on in the same method I have this code:

    pd4ml.enableDebugInfo();
    pd4ml.useTTF( fontPath, true );

    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:

    #
    #Wed Mar 24 07:21:32 EDT 2010
    adobe.font.metrics=true
    debug.info.enable=false
    document.author=
    document.title=
    footer.color=#000000
    footer.font.face=Courier New
    footer.font.size=10
    footer.font.style=0
    footer.height=12
    footer.init.page.num=1
    footer.page.num.align=right
    footer.page.num.template=null
    footer.pages.to.skip=0
    footer.title.align=center
    footer.title.template=null
    header.color=#000000
    header.font.face=Courier New
    header.font.size=10
    header.font.style=0
    header.height=12
    header.init.page.num=1
    header.page.num.align=right
    header.page.num.template=null
    header.pages.to.skip=0
    header.title.align=center
    header.title.template=null
    images.interpolate=false
    insets.bottom=10
    insets.left=10
    insets.right=10
    insets.top=10
    insets.units=mm
    page.bookmarks.destinations=false
    page.bookmarks.headings=false
    page.format=A4
    page.hyperlinks=true
    page.orientation=false
    pdf.forms.enable=false
    proxy.host=
    proxy.port=0
    rendering.patch=true
    rendering.split=true
    table.breaks.enable=false
    ttf.fonts.default.monospace=
    ttf.fonts.default.sansserif=
    ttf.fonts.default.serif=
    ttf.fonts.dir=com/xxxx/xxxx/portal/render/document
    userSpace.adjustToContent=false
    userSpace.width=800
    viewer.executeble=acroread.exe
    viewer.params=
    window.height=100
    window.width=100
    window.x=850
    window.y=600

    Finally, my pd4fonts.properties file is located in the same directory as the fonts and pd4browser.properties and it contains the following:

    #this is an autogenerated file. please remove manually any references to copyrighted fonts
    #Wed Mar 24 07:21:32 EDT 2010
    KaiTi_GB2312=SIMKAI.TTF
    xxxx Fixed 2 Unicode=xxxx-fixed2U.ttf
    xxxx Fixed Unicode=xxxx-fixedu.ttf
    xxxx Fixed Unicode B=xxxx-FixedU_B.ttf
    xxxx Fixed Unicode C=xxxx-FixedU_C.ttf
    xxxx Fixed Unicode D=xxxx-FixedU_D.ttf
    xxxx Fixed Unicode F=xxxx-FixedU_F.ttf
    xxxx Prop Unicode B=xxxx-PropU_B.ttf
    xxxx Prop Unicode C=xxxx-PropU_C.ttf
    xxxx Prop Unicode D=xxxx-PropU_D.ttf
    xxxx Prop Unicode F=xxxx-PropU_F.ttf
    xxxx Proportional Unicode=xxxx-propu.ttf

    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

    #27926

    Try turning on PD4ML debugging and you should be able to see the TTFs loading in the logs. To see the debugging, you may need to restart your application server. There are some default CSS styles like “simsum” for Chinese that you could map in your pd4fonts.properties file (part of the font substitution functionality, I believe).

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

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