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

    Hi I am using the Pro version Java API trying to render a UTF-8 page. I am calling a JSP page from a java class, and I have verified my page has both the tag for utf-8 as well as the jsp encoding type set properly as well. When I enable debugging, however, I get the following output:

    not yet in cache: java:fonts/pd4fonts.properties
    using content encoding from HTTP header: UTF-8
    new parse attempt with: ISO8859_1
    not yet in cache: java:fonts/arial.ttf
    read ‘arial’ from java:fonts/arial.ttf
    not yet in cache: java:fonts/arialbd.ttf
    read ‘arial bold’ from java:fonts/arialbd.ttf

    I can’t figure out where the ISO8859_1 is coming from. I verified my system property ‘file.encoding’ is also set to UTF-8. All my UTF-8 characters come out as junk on the page. The same page from a browser renders correctly, but incorrectly in the PDF.

    This is my code:
    java.io.FileOutputStream fos = new java.io.FileOutputStream(outputPDFFile);
    PD4ML pd4ml = new PD4ML();
    HttpSession session = request.getSession();
    session.setAttribute(RequestAttributeNames.USER_ATTRIBUTE, session.getAttribute(RequestAttributeNames.USER_ATTRIBUTE));
    pd4ml.useServletContext(request.getSession().getServletContext());
    pd4ml.setSessionID(request.getSession().getId());

    Cookie[] cookies = request.getCookies();
    for(Cookie cookie: cookies){
    pd4ml.setCookie(cookie.getName(), cookie.getValue());
    }

    pd4ml.setPageInsets(new Insets(40, 20, 40, 20));
    pd4ml.setHtmlWidth(950);
    pd4ml.enableDebugInfo();

    pd4ml.useTTF( “java:fonts” true );
    pd4ml.setDefaultTTFs(“Times New Roman”, “Arial”, “Courier New”);
    }
    pd4ml.render(“http://blah.jsp”, fos);
    fos.close();

    Is there any way to see what the debug message ‘new parse attempt with: ISO8859_1’ is coming from? Without the source of the library it’s hard to tell what is going on.

    Ryan

    #27542

    I found the problem, it was not with my library but an errant tag that was setting the charset to 8859-1, which was confusing pd4ml. After correcting that my utf-8 characters are now correct.

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

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