Forum Replies Created
-
AuthorPosts
-
in reply to: Allow document merge without password January 11, 2021 at 14:12#34084
sample2.pdf is password restricted. Password: 1234
in reply to: Allow document merge without password January 11, 2021 at 14:11#34083in iText it can be done, by: .setUnethicalReading(true);
in reply to: Can’t submit issue on Troubleshooting page. Form doesn’t submit correctly. January 4, 2021 at 10:22in reply to: Can’t submit issue on Troubleshooting page. Form doesn’t submit correctly. January 4, 2021 at 10:22#34074Can’t add comment to post 34069
in reply to: Encoding problem November 9, 2020 at 14:49#34017OMG, 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 November 9, 2020 at 13:54#34015If 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 November 9, 2020 at 12:52#34014Also, receive Java error if I use:
<h1>First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å</h1>java.lang.StringIndexOutOfBoundsException: String index out of range: -1in reply to: Encoding problem November 9, 2020 at 12:41#34013Received 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)); -
AuthorPosts
