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

    Hi, I have this code:

        public static void main(String[] args) throws Exception {
            PD4ML pd4ml = new PD4ML();
            pd4ml.applyLicense("license......");
            pd4ml.setHtmlWidth(300);
            pd4ml.useTTF("src/main/resources/fonts");
    
            String html = Files.readString(Paths.get("src/main/resources/sblend.html"));
            ByteArrayInputStream bais = new ByteArrayInputStream(html.getBytes("UTF-8"));
            pd4ml.readHTML(bais, null, "utf-8");
    
            File pdf = File.createTempFile("result", ".pdf");
            FileOutputStream fos = new FileOutputStream(pdf);
            pd4ml.writePDF(fos);
    
            Desktop.getDesktop().open(pdf);
        }

    This code refers to this HTML file:

    <?xml version="1.0" encoding="utf-8" ?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
    Ciao perch&eacute; cio&egrave; 笔记本/筆記本
    ерберта
    Уэллса,
    часто именуемое
    романом.
    Публиковалось
    с продолжением
    в 1904&mdash;1905 годах;
    книжное изда
    </body>
    </html>

    If you open it through a browser, you see (see attachment 1: browser.png).

    If you open it through PD4ML, you see (see attachment 2: pd4ml.pdf)

    So: the characters which are cyrillic or chinese are all rendered as question marks (“?”).

    How can we solve the problem?

    Attachments:
    You must be logged in to view attached files.
    #37110

    The attached PDF is a typical result of PDF conversion, when no TTF embedding feature configured.

    Did you have a chance to take a look at

    How to configure PDF fonts

    PD4ML Fonts Tool


    ?

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

You must be logged in to reply to this topic.