Forum Replies Created

Viewing 15 posts - 3,826 through 3,840 (of 4,234 total)
  • Author
    Posts
  • #34008

    Thank you for the report!

    We’ll address the issue and let you know as soon as there is a solution or workaround.

    #34009

    We’ll address the issue and let you know as soon as there is a solution or workaround.

    Thanks. Actually my goal was to clarify with you whether this is an issue or not.

    #34010

    If v3 and v4 RTF output differs in such details – it looks like an issue from our perspective. We are trying to keep RTF modules in v3 and v4 branches in sync.

    Unfortunately we cannot assign the high priority to the issue – right now there is a number of urgent tasks to be completed. But I hope we’ll manage to analyze it this week.

    in reply to: Technical questions / Troubleshooting
    #34011

    Instead of “First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å|ā”
    I receive: “First Pageä|ä|á|Ä…|â|à |ả|ã|ạ|ă|ằ|Ạ̄|ẳ|áºμ|ặ|ầ|ấ|ẩ|ẫ|Ẕ

    Please, help me, how can I fix this?
    My code:
    PD4ML pd4ml = new PD4ML(); String html = "First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å|ā"; System.out.println(html); byte[] myBytes = html.getBytes(StandardCharsets.UTF_8); InputStream stream = new ByteArrayInputStream(myBytes); pd4ml.useTTF("C:\\Windows\\Fonts", true); pd4ml.readHTML(stream); String output_path = "C:\\test\\test.pdf"; try(OutputStream outputStream = new FileOutputStream(output_path)) { pd4ml.writePDF(outputStream); } Desktop.getDesktop().open(new File(output_path));

    in reply to: Encoding problem
    #34012

    The string you received is typical for a charset mismatch.

    As you see your test string is not well-formed HTML. You may solve the issue by a prefixing the string with an HTML header defines the correct charset – in your case it should be UTF-8.

    Or you can use readHTML() API method with an encoding parameter, i.e.
    https://pd4ml.tech/javadoc/com/pd4ml/PD4ML.html#readHTML-java.io.InputStream-java.net.URL-java.lang.String-
    Try to specify “UTF8” there.

    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));

    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
    #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
    #34016

    We’ll analyze the issue and let you know.

    BTW: does it change the output if you remove the charset from
    byte[] myBytes = html.getBytes(StandardCharsets.UTF_8);
    to
    byte[] myBytes = html.getBytes();
    ?

    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
    #34018

    Unfortunately we had no success to reproduce the original as well as the last issues you reported.

    I would suspect you saved the source Java file as UTF-8, but your build assumes another default Java source encoding (passed as -encoding param of javac or inherited from the OS). It would somehow explain the oddities you faced with, but there are still questions open.

    To omit the build environment dependency and to match typical PD4ML usage scenarios, save the text or HTML content to an external file and refer to it from the Java code.

    FYI: the ‘true’ parameter in pd4ml.useTTF("C:\\Windows\\Fonts", true) to reindex all system fonts with every conversion call – it is not a good idea from performance perspective. Index once and reuse the font mapping data. See https://pd4ml.tech/pdf-fonts/

    You may call pd4ml.useTTF() multiple times, but I guess the wrong rendering of the last char is because of a missing font – it is something wrong with encodings.

    in reply to: Technical questions / Troubleshooting
    #34048

    Hello,

    I have set the page background using the following

    <pd4ml:page.background> <div style="width: 100%; height: 100%; background-color: rgb(219,221,227);"></div> </pd4ml:page.background>

    But it doesn’t fill the whole page. I have an area at the foot of the page in white.

    Am I missing anything to completely fill the page with a colour?

    Thanks for any help.

    in reply to: Technical questions / Troubleshooting
    #34060

    I’ve noticed that page margins are different in RTF files generated by PD4ML v3 and v4.
    In v3 it is 35” while in v4 it is 28”. (BTW I visually see the difference in PDF document as well).
    Configs for PD4ML class seem to be the same (PageSize: 595,842; PageIncets/PageMargins: 20,20,20,20; HtmlWidth: 850). I assume PageIncets in v3 means the same as PageMargins in v4. If no, could you please point me how can I tune PD4ML v4 to have the same margins as in v3?

    Also there is difference in spacing between lines for <div> elements located within common <section> element, for example:
    <section> <header> <h4 property="dc:title" class="niv3" datatype="rdf:XMLLiteral">Section Header</h4> </header> <div>Section Content</div> <div class='arial-font'>This text should be in Arial</div> <div class='courier-new-font'>This text should be in Courier New</div> </section>

    This is only RTF issue (PDF is fine).

    Please see original html file, java code and resulting RTF/PDF files attached.

    Attachments:
    You must be logged in to view attached files.
    in reply to: Page margins and line spacing differ in PD4ML v4 vs v3
    #34062

    Hello,

    Are there any update on the question above?

    Thanks,
    Nina

    in reply to: Technical questions / Troubleshooting
    #34063

    test

Viewing 15 posts - 3,826 through 3,840 (of 4,234 total)