Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: Allow document merge without password
    #34084

    sample2.pdf is password restricted. Password: 1234

    in reply to: Allow document merge without password
    #34083

    in iText it can be done, by: .setUnethicalReading(true);

    #34074

    Can’t add comment to post 34069

    in reply to: Encoding problem
    #34017

    OMG, It helped, thank you.
    Except for the last character: ā which is now: “�?”

    Full output, with Windows fonts:
    First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å|�?
    Full output, without Windows fonts:
    First Pageä|ä|á|?|â|à|?|ã|?|?|?|?|?|?|?|?|?|?|?|?|å|??

    I think that means, some fonts are missing, yes?
    Where else I could get/download them?
    Can I use “pd4ml.useTTF” function multiple times?

    Working code:

    PD4ML pd4ml = new PD4ML();
            String html ="First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å|ā";
            byte[] myBytes = html.getBytes();
            InputStream stream = new ByteArrayInputStream(myBytes);
            pd4ml.useTTF("C:\\Windows\\Fonts", true);
            pd4ml.readHTML(stream);
    
            String output_path = "C:\\test\\zxccc.pdf";
    
            try(OutputStream outputStream = new FileOutputStream(output_path)) {
                pd4ml.writePDF(outputStream);
            }
            Desktop.getDesktop().open(new File(output_path));

    in reply to: Encoding problem
    #34015

    If I use pd4ml.readHTML(new URL("file:///C:/test/test.html"));
    from local file, all is OK, even without well formatted HTML.

    test.html file content:
    <h1>First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å|ā</h1>

    in reply to: Encoding problem
    #34014

    Also, receive Java error if I use: <h1>First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å</h1>

    java.lang.StringIndexOutOfBoundsException: String index out of range: -1

    in reply to: Encoding problem
    #34013

    Received same result with, fixed well formated html, setting HTML header charset and using readHTML with encoding parametr.

    PD4ML pd4ml = new PD4ML();
            String html = "<html>" +
                    "   <head>\n" +
                    "       <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n" +
                    "   </head>" +
                    "   <body>" +
                    "       First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å" +
                    "   </body>" +
                    "</html>";
            System.out.println(html);
            byte[] myBytes = html.getBytes(StandardCharsets.UTF_8);
            System.out.println(new String(myBytes, StandardCharsets.UTF_8));
            InputStream stream = new ByteArrayInputStream(myBytes);
            pd4ml.overrideDocumentEncoding("utf-8");
            pd4ml.useTTF("C:\\Windows\\Fonts", true);
            pd4ml.readHTML(stream, new URL("https://google.com"), "utf-8");
    
            String output_path = "C:\\test\\zxccc.pdf";
    
            try(OutputStream outputStream = new FileOutputStream(output_path)) {
                pd4ml.writePDF(outputStream);
            }
            Desktop.getDesktop().open(new File(output_path));

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