Forum Replies Created
-
AuthorPosts
-
in reply to: Local converter 398 fx4/fx5 crash with a NPE August 31, 2016 at 09:19#29890
Thank you and sorry for my late reply. It didn’t occur to me to check back here earlier.
The debug version now yields the following error:
<br /> java.lang.NullPointerException<br /> at java.io.File.<init>(Unknown Source)<br /> at org.zefer.pd4ml.tools.PD4Browser.guessExecutable(PD4Browser.java:222)<br /> at org.zefer.pd4ml.tools.PD4Browser.<init>(PD4Browser.java:215)<br /> at org.zefer.pd4ml.tools.PD4Browser.showGUI(PD4Browser.java:1132)<br /> at org.zefer.pd4ml.tools.PD4Browser.main(PD4Browser.java:1116)<br />
Cheers, Viktor
in reply to: Memory leak August 31, 2016 at 10:17#29924HTML rendering (the first phase of HTML-to-PDF conversion) is a resource consuming task – you know that from your everyday browsing experience: a bulky web page rendering can “eat” all available RAM and block even a native web browser and slow down the system. HTML renderer instantiates a set of objects even for any standalone whitespace. Almost all allocated RAM is released after PD4ML object is garbage collected.
There is only exception (I guess, you see it as a “memory leak”) is a resource caching. The cache (static Map object) holds soft references to loaded resource byte arrays (images, stylesheets etc), which are to be auto-deleted when JVM is short of RAM. You may force the resource releasing by pd4ml.clearCache() API call.
in reply to: HTML/CSS rendering issues September 1, 2016 at 21:42#27097Hello. I am trying to render html to pdf such that only a portion of the html content is rendered to pdf in dual column format. I want the output to look like this:
Stuff before the dual-column text
column1text column2text
column1text column2text
… …Here is a sample test:
@Test<br /> public void dualColumnTest() throws Exception {<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.outputFormat(PD4ML.PDF);<br /> Insets insets = new Insets(10,10,10,10);<br /> pd4ml.setPageInsetsMM(insets);<br /> pd4ml.setHtmlWidth(800);<br /> pd4ml.adjustHtmlWidth();<br /> Map<String, String> m = new HashMap<String, String>();<br /> m.put(PD4Constants.PD4ML_MEDIA_TYPE_PRINT, "override");<br /> pd4ml.setDynamicParams(m);<br /> pd4ml.generateMulticolumn(2, 5, true);<br /> String content = "" +<br /> "<html><body>" +<br /> "<p>Stuff before the dual-column text</p>" +<br /> "<div usedualcolumn="true"><p>Lots of text to be placed in dual columns</p></div>" +<br /> "</body></html>";<br /> StringReader htmlInput = new StringReader(content);<br /> FileOutputStream pdfOutput = new FileOutputStream("c:/bb/foo.pdf");<br /> pd4ml.render(htmlInput, pdfOutput);<br /> }<br />
But when I use generateMulticolumn(2,5,true) it sets it for the entire document. How can I select only a portion of the html content for dual column pdf? Thank you!
in reply to: Multiple Column PDF September 2, 2016 at 18:06#29925I should add that I also tried to get the html properly rendering in browser with dual column. I did it using this head meta:
.printDualColumn {
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
}And then I surrounded the content which needs dual column printing with:
It renders correctly in dual column format in the browser from the html. But when I render the html to pdf using pd4ml it does not render in two column.
@Test<br /> public void dualColumnTest2() throws Exception {<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.outputFormat(PD4ML.PDF);<br /> Insets insets = new Insets(10,10,10,10);<br /> pd4ml.setPageInsetsMM(insets);<br /> pd4ml.setHtmlWidth(800);<br /> pd4ml.adjustHtmlWidth();<br /> Map<String, String> m = new HashMap<String, String>();<br /> m.put(PD4Constants.PD4ML_MEDIA_TYPE_PRINT, "override");<br /> pd4ml.setDynamicParams(m);<br /> String content = "" +<br /> "<html>" +<br /> "<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><style type="text/css">" +<br /> "n.printDualColumn {n" +<br /> "tttt-moz-column-count: 2;n" +<br /> "tttt-webkit-column-count: 2;n" +<br /> "ttttcolumn-count: 2;n" +<br /> "ttt}n" +<br /> "</style></head>" +<br /> "<body>" +<br /> "<p>Stuff before the dual-column text</p>" +<br /> "<div class="printDualColumn">" +<br /> "Lots of text to be placed in dual columns" +<br /> "Lots of text to be placed in dual columns" +<br /> "Lots of text to be placed in dual columns" +<br /> "Lots of text to be placed in dual columns" +<br /> "</div>" +<br /> "</body></html>";<br /> StringReader htmlInput = new StringReader(content);<br /> FileOutputStream htmlInputFile = new FileOutputStream("c:/bb/foo2.html");<br /> htmlInputFile.write(content.getBytes());<br /> FileOutputStream pdfOutput = new FileOutputStream("c:/bb/foo2.pdf");<br /> pd4ml.render(htmlInput, pdfOutput);<br /> }
Is there something I can do either in the css or in my java code?
in reply to: Cannot find log messages and how to enable them September 23, 2016 at 19:01#29864Related question (I’m using java api):
Documentation for pd4ml.enableDebugInfo() states that output goes to STDOUT. Is there a way using the pd4ml API for me to specify a special log file for pd4ml?
in reply to: Troubleshooting September 27, 2016 at 23:22#27098Hi All,
I’m getting a “Java Out Of Memory Error” when trying to convert a large html report to PDF (see log output below). Does anyone know how to resolve this problem?
I’ve seen some posts of a similar problem where the recommendation was to upgrade to 3.95. The date of my pd4ml.jar file is Dec 10, 2015, so I think I am already on a version that is beyond 3.95. If anyone knows how to tell for sure, please let me know.
Thanks.
Aaron
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:421)
at java.lang.StringBuilder.append(StringBuilder.java:136)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at java.util.AbstractMap.toString(AbstractMap.java:534)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuffer.append(StringBuffer.java:265)
at org.zefer.html.doc.q.toString(Unknown Source)
at org.zefer.html.doc.cb.o00000(Unknown Source)
at org.zefer.html.doc.q.o00000(Unknown Source)
at org.zefer.html.doc.q.øÒ0000(Unknown Source)
at org.zefer.html.doc.n.new(Unknown Source)
at org.zefer.html.doc.n.o00000(Unknown Source)
at org.zefer.html.doc.view.d.o00000(Unknown Source)
at org.zefer.html.doc.cb.o00000(Unknown Source)
at org.zefer.html.doc.q.o00000(Unknown Source)
at org.zefer.html.doc.q.oô0000(Unknown Source)
at org.zefer.html.doc.n.new(Unknown Source)
at org.zefer.html.doc.n.o00000(Unknown Source)
at org.zefer.html.doc.view.d.o00000(Unknown Source)
at org.zefer.html.doc.cb.o00000(Unknown Source)
at org.zefer.html.doc.view.d.o00000(Unknown Source)
at org.zefer.html.doc.cb.o00000(Unknown Source)
at org.zefer.html.doc.Document.layout(Unknown Source)
at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at Pd4Cmd.o00000(Unknown Source)
at Pd4Cmd.main(Unknown Source)
TableCellElement(td) {colspan=4, display=table-cell}in reply to: HTML/CSS rendering issues September 28, 2016 at 07:56#27099Hello,
we have experienced a problem with an endless loop occurring on specific HTML (see below). Eventually the thread dies on memory exhaustion.Please find the trigger/symptom description below. We would be grateful for a quick fix as the problem is currently affecting us on our live system.
Causing versions: from 3.9.9. Version 3.9.8fx5 does not exhibit that behavior yet.
The triggering HTML is as follows:
<br /> <html lang="de"><br /> <body><br /> <table><br /> <tr><br /> <td><br /> <span style="display:none;"><br /> <a style="display:block;" ><br /> <span style="float: left;"></span><br /> </a><br /> </span><br /> <span style="display:none;"><br /> </span><br /> </td><br /> <td><br /> </td><br /> </tr><br /> </table><br /> </body><br /> </html><br />
In the endless loop situation, the code position seems to be this one:
<br /> java.util.zip.Deflater.deflateBytes(Native Method)<br /> java.util.zip.Deflater.deflate(Deflater.java:444)<br /> java.util.zip.Deflater.deflate(Deflater.java:385)<br /> org.zefer.pd4ml.pdf.f.o00000(Unknown Source)<br /> org.zefer.pd4ml.pdf.c.õO0000(Unknown Source)<br /> org.zefer.pd4ml.pdf.c.ÓÓ0000(Unknown Source)<br /> org.zefer.pd4ml.pdf.PD4Device.startNewPage(Unknown Source)<br /> org.zefer.pd4ml.PD4ML.o00000(Unknown Source)<br /> org.zefer.pd4ml.PD4ML.render(Unknown Source)<br /> ...<br />
Before the endless loop begins, the following messages come in the console log:
<br /> TableCellElement(td) {display=table-cell}<br /> <br /> java.lang.ClassCastException: org.zefer.html.doc.b cannot be cast to org.zefer.html.doc.o<br /> at org.zefer.html.doc.r.ôØ0000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.öØ0000(Unknown Source)<br /> at org.zefer.html.doc.o.Ò00000(Unknown Source)<br /> at org.zefer.html.doc.o.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.Document.layout(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.render(Unknown Source)<br /> ...<br /> TableCellElement(td) {display=table-cell}<br /> ContentElement(pd4content) [ ] {line-height=scale (1.2000000476837158), display=table-cell}<br /> <br /> java.lang.ClassCastException: org.zefer.html.doc.b cannot be cast to org.zefer.html.doc.o<br /> at org.zefer.html.doc.r.ôO0000(Unknown Source)<br /> at org.zefer.html.doc.q.o00000(Unknown Source)<br /> at org.zefer.html.doc.q.Öo0000(Unknown Source)<br /> at org.zefer.html.doc.q.float(Unknown Source)<br /> at org.zefer.html.doc.view.d.Ó00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.öØ0000(Unknown Source)<br /> at org.zefer.html.doc.o.Ò00000(Unknown Source)<br /> at org.zefer.html.doc.o.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.Document.layout(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.render(Unknown Source)<br /> ...<br /> TableCellElement(td) {display=table-cell}<br /> <br /> java.lang.ClassCastException: org.zefer.html.doc.b cannot be cast to org.zefer.html.doc.o<br /> at org.zefer.html.doc.r.ôØ0000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.Object(Unknown Source)<br /> at org.zefer.html.doc.o.Ò00000(Unknown Source)<br /> at org.zefer.html.doc.o.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.Document.layout(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.render(Unknown Source)<br /> ...<br /> TableCellElement(td) {display=table-cell}<br /> ContentElement(pd4content) [ ] {line-height=scale (1.2000000476837158), display=table-cell}<br /> <br /> java.lang.ClassCastException: org.zefer.html.doc.b cannot be cast to org.zefer.html.doc.o<br /> at org.zefer.html.doc.r.ôO0000(Unknown Source)<br /> at org.zefer.html.doc.q.o00000(Unknown Source)<br /> at org.zefer.html.doc.q.Öo0000(Unknown Source)<br /> at org.zefer.html.doc.q.float(Unknown Source)<br /> at org.zefer.html.doc.view.d.Ó00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.Object(Unknown Source)<br /> at org.zefer.html.doc.o.Ò00000(Unknown Source)<br /> at org.zefer.html.doc.o.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.Document.layout(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.render(Unknown Source)<br /> ...<br /> TableCellElement(td) {display=table-cell}<br /> <br /> java.lang.ClassCastException: org.zefer.html.doc.b cannot be cast to org.zefer.html.doc.o<br /> at org.zefer.html.doc.r.ôØ0000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.o00000(Unknown Source)<br /> at org.zefer.html.doc.o.Ò00000(Unknown Source)<br /> at org.zefer.html.doc.o.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.Document.layout(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.render(Unknown Source)<br /> ...<br /> TableCellElement(td) {display=table-cell}<br /> ContentElement(pd4content) [ ] {line-height=scale (1.2000000476837158), display=table-cell}<br /> <br /> java.lang.ClassCastException: org.zefer.html.doc.b cannot be cast to org.zefer.html.doc.o<br /> at org.zefer.html.doc.r.ôO0000(Unknown Source)<br /> at org.zefer.html.doc.q.o00000(Unknown Source)<br /> at org.zefer.html.doc.q.Öo0000(Unknown Source)<br /> at org.zefer.html.doc.q.float(Unknown Source)<br /> at org.zefer.html.doc.view.d.Ó00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.o00000(Unknown Source)<br /> at org.zefer.html.doc.o.Ò00000(Unknown Source)<br /> at org.zefer.html.doc.o.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.Document.layout(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.render(Unknown Source)<br /> ...<br />
Thank you, best regards,
Viktorin reply to: HTML/CSS rendering issues September 29, 2016 at 02:10#27100How can I force PD4ML to not resolve links in the html?
Our tomcat servers are strictly not allowed to access the public internet, and as such resolving of links in the html that we are converting to pdf fails.
Is there a switch or setting that can be used to stop this?
in reply to: HTML/CSS rendering issues September 29, 2016 at 09:46#27101Hello,
similarly to the ClassCastException and the endless loop, a somewhat similar combination leads to a NPE with 3.9.9fx1.
The code is:
<br /> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><br /> <html><br /> <body><br /> <table><br /> <tr><td><br /> <a style="display: block;"><br /> <span style="float: left;display: inline-block;"></span><br /> </a><br /> </td></tr><br /> <br /> <tr><td><br /> <div style="display: none;"><br /> <table><br /> <tr><td><br /> <a style="float: left;"><span style="display: block;"></span></a><br /> <a style="float: right;"><span style="display: block;"></span></a><br /> </td></tr><br /> </table><br /> </div><br /> <br /> </td></tr><br /> </table><br /> </body><br /> </html><br />
and the exception
<br /> java.lang.NullPointerException<br /> at org.zefer.html.doc.o.o00000(Unknown Source)<br /> at org.zefer.html.doc.r.ôO0000(Unknown Source)<br /> at org.zefer.html.doc.q.o00000(Unknown Source)<br /> at org.zefer.html.doc.q.void(Unknown Source)<br /> at org.zefer.html.doc.o.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.view.d.o00000(Unknown Source)<br /> at org.zefer.html.doc.db.o00000(Unknown Source)<br /> at org.zefer.html.doc.Document.paint(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)<br /> at org.zefer.pd4ml.PD4ML.render(Unknown Source)<br /> ...<br />
Please let us know if we can supply any additional information.
Thank you + best regards,
Viktorin reply to: NullPointerException in a table/disp:none/float combination September 30, 2016 at 10:57#29936The issue is reproduced. We’ll begin to work on it next week.
in reply to: How can I force PD4ML to not resolve links in the html? September 30, 2016 at 11:21#29935pd4ml.disableHyperlinks() method is what you looking for.
But… Some PDF viewers (like Acroread) parse PDF document content and turn URL-like strings into hyperlinks. The behavior can be disabled in PDF viewer properties by the end-user, but it cannot be done automatic way from a PDF document.
See in Acroread:
Edit->Preferences->General->Generate links from URLsin reply to: ClassCastException with endless loop in PDF page generation September 30, 2016 at 11:38#29929Reproduced. The issue processing scheduled to the next week.
in reply to: Java Out Of Memory Error September 30, 2016 at 11:40#29927Have you overridden the default “tiny” JVM heap size with something like -Xmx512m ?
in reply to: Cannot find log messages and how to enable them September 30, 2016 at 11:56#29865It can be done with Java API:
[language=java:33km8lff]public void redirectDebugInfo(PrintStream debugOutput) {
System.setOut(debugOutput);
System.setErr(debugOutput);
}[/language:33km8lff]in reply to: ClassCastException with endless loop in PDF page generation October 5, 2016 at 09:17#29930Cool, thank you!
-
AuthorPosts