Forum Replies Created
-
AuthorPosts
-
in reply to: Issues with position:relative October 11, 2012 at 19:45#29104
The forthcoming PD4ML release fixes the issue #1 (overflow: hidden).
Unfortunately the second issue cannot be fixed with the current PD4ML architecture.
Layouts with absolute positioning + page breaks are still handled differently by different browsers in print mode – there is no common practice, accepted by every web browser vendor (as far as I know).
Some of them print absolutely positioned elements on the first page only. Some of them respect page breaks in absolute positioning coordinates, some (and PD4ML) do not. In absolute positioning model PD4ML interprets a sequence of PDF pages as a continuous space without page breaks.
The visual defects of the resulting PDF layout are caused by an attempt to combine elements, belong to different positioning schema.
I could only recommend to redesign the layout and to avoid absolutely positioned elements there.
in reply to: Issues with position:relative October 12, 2012 at 06:06#29105Thank You for Your response. I will test this release as soon as it will be available. Regarding second issue, I understand the problem with this and I will take a look what can I do with my design to fix it.
in reply to: Email Id Overlap issue October 15, 2012 at 14:56#29140The updated version is already available for download.
in reply to: pd4ml https image urls October 18, 2012 at 11:17#28166Hi,
I’m having the same issue here and I’m not restarting the JVM.
Code is very simple, maybe cache is not reused if different PD4ML objects are created?public static void convert(String html, ByteArrayOutputStream baos, ServletContext servletContext, String baseUrl)
throws InvalidParameterException, IOException {
try {
if (html != null && html.length() > 0) {
PD4ML pd4ml = new PD4ML();pd4ml.enableDebugInfo();
pd4ml.setPageSize(LANDSCAPE_VALUE ? pd4ml.changePageOrientation(FORMAT) : FORMAT);
if (“mm”.equals(UNITS_VALUE)) {
pd4ml.setPageInsetsMM(new Insets(TOP_VALUE, LEFT_VALUE, BOTTOM_VALUE, RIGHT_VALUE));
} else {
pd4ml.setPageInsets(new Insets(TOP_VALUE, LEFT_VALUE, BOTTOM_VALUE, RIGHT_VALUE));
}pd4ml.setHtmlWidth(USER_SPACE_WIDTH);
pd4ml.render(new StringReader(html), baos, new java.net.URL(baseUrl));
}
} catch (InvalidParameterException e) {
logger.error(“Error rendering PDF”, e);
} catch (IOException e) {
logger.error(“Error rendering PDF”, e);
}
}Thanks,
in reply to: Troubleshooting October 19, 2012 at 11:58#26786If an HTML page contains an img tag that refers a PNG image that all browsers display ok but the sun.awt.image.PNGImageDecoder think is broken, then generating a PDF by PD4ML will hang forever. This is particularly disturbing in a web application where users can upload their own images and the thread that gets stuck is likely a HTTP worker thread. Then it is possible easy to DOS attack the system, intentionally or unintentionally.
The thread gets stuck here (using the latest and greatest 380fx8 build):
java.lang.Thread#sleep:-2<br /> org.zefer.pd4ml.pdf.j$_b#Ò00000:-1<br /> org.zefer.pd4ml.pdf.c#ÒÒ0000:-1<br /> org.zefer.pd4ml.pdf.c#ø00000:-1<br /> org.zefer.pd4ml.pdf.c#close:-1<br /> org.zefer.pd4ml.pdf.PD4Device#dispose:-1<br /> org.zefer.pd4ml.PD4ML#o00000:-1<br /> org.zefer.pd4ml.PD4ML#render:-1<br /> net.xxxxx.tm.handler.DocumentManagerHandler#writePDFWithHeader:263<br /> net.xxxxx.rte.action.ContentSaveToPdfAction#doAction:86<br /> net.xxxxx.core.struts.action.BaseCourseAction#doAction:85<br /> net.xxxxx.core.struts.action.BaseAction#execute:158<br /> org.apache.struts.action.RequestProcessor#processActionPerform:425<br /> org.apache.struts.action.RequestProcessor#process:228<br /> net.xxxxx.core.struts.PPRequestProcessor#process:77<br /> org.apache.struts.action.ActionServlet#process:1913<br /> org.apache.struts.action.ActionServlet#doGet:449<br /> javax.servlet.http.HttpServlet#service:617<br /> javax.servlet.http.HttpServlet#service:717
The asynchronous image loading bails out with the following exception:
sun.awt.image.PNGImageDecoder$PNGException: Broken file<br /> at sun.awt.image.PNGImageDecoder.pngassert(PNGImageDecoder.java:94)<br /> at sun.awt.image.PNGImageDecoder.handleChunk(PNGImageDecoder.java:107)<br /> at sun.awt.image.PNGImageDecoder.getData(PNGImageDecoder.java:726)<br /> at sun.awt.image.PNGImageDecoder.produceImage(PNGImageDecoder.java:252)<br /> at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:269)<br /> at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:205)<br /> at sun.awt.image.ImageFetcher.run(ImageFetcher.java:169)
…and PD4ML never notice this and gets stuck inside a loop waiting for Image.getHeight() returning anything other than -1 (which it will never be since it can’t be loaded). Thankfully it sleeps 10ms between each height check, otherwise it would have CPU starved the server in the process. But the any InterruptedException while sleeping is swallowed without leaving the loop, so it is rather hard to interrupt the infinite loop from the outside.
Of course PD4ML must detect that the image loading fails or at the very least abort waiting after a few seconds (or minutes if you like).
I consider this a rather big flaw in PD4ML error handling. I attach an example of such a broken PNG image.
in reply to: sup and sub HTML Tag support? October 19, 2012 at 13:41#29133Very good. Thank you!
in reply to: HTML/CSS rendering issues October 24, 2012 at 20:40#26787I’m employee from company named VivereBrasil, a we are using you PD4ML lib. Some time in our body text, only in PDF file, result from renderizing process, shows a P tag with a style=”text-align: justify;” with a break in a wrong place, as showed in attached case.zip file.
in reply to: General questions / FAQ October 26, 2012 at 11:28#26788I need Stylized PDFs that convert directly from HTML to PDF as is in original format. Also it should take care of following thing:
a) Page Break
b) Horizontal scrolling of tables
c) Fixing the text background and text color in some combination which when converted to grey scale could become unreadable.
d) Fixing the Page footers which might come in half page when printed
e) Fixing the extra space which might come when printed on A4 page.Is this tool is taking care of all of the above thing?
Reply ASPSThanks
in reply to: General Query October 29, 2012 at 10:27#29150a) Page Break
PD4ML allows to control page breaks: to force a break with CSS style, or with proprietary tag and to keep some content sections not broken (page-break-inside: avoid).
b) Horizontal scrolling of tables
If a table does not fit a page, it is continued on the next page.
c) Fixing the text background and text color in some combination which when converted to grey scale could become unreadable.
You may apply additional styles with addStyle() PD4ML API call to resolve some conversion specific visual problems.
d) Fixing the Page footers which might come in half page when printed
A HTML sample of more detailed description would help to understand what is the problem and how to solve it.
e) Fixing the extra space which might come when printed on A4 page.
Most probably the problem can be solved by a decreasing of htmlWidth conversion parameter.
in reply to: Problem with P tag containing attribute text-align: justify October 29, 2012 at 14:58#29143The issue is not reproducible on our workstations with v380fx8. Could you please re-test it with the actual version – recently we slightly refined line break logic.
in reply to: Newbie question: How to page break October 30, 2012 at 07:01#27866I dint get one point in above query , if you wantto export data to PDF , why do you wantt o render it as HTML(or any other presentation file you are using).
Just put your HTML code generated in a StringBuffer and pass it to render() method of PD4ML class. The BYTEOUTPUTARRAYSTREAM recieved from this method can be passed to OUTPUTSTREAM and your PDF will be downloaded.
in reply to: General questions / FAQ October 31, 2012 at 14:47#26789Hi,
While converting the dxl file attached(attached as text file) to pdf
Same content repeating again.Also the conversion is very slow and I am getting out of memory error as well.Please help to resolve the above two issues.
in reply to: HTML tags from JSF written to pdf file November 5, 2012 at 05:37#28215I want to render html tags in pdf using jsf.
can any one provide the solution for this?in reply to: Problem with P tag containing attribute text-align: justify November 5, 2012 at 13:23#29144We’ve tryed, through our tests reproduce this issue with the new version and the problem appears solved.
Thank you all.
Regards.in reply to: Background-color: transparent not rendering correctly November 5, 2012 at 14:34#29128we are still encountering this issue with “PD4ML 380fx8 Pro”
the below mentioned div-container is still rendered with black-background
this is the HTML we render:
background-color:transparent
this is the JAVA Code we use:
PD4ML pd4ml = new PD4ML();
pd4ml.enableDebugInfo();Dimension dimension = new java.awt.Dimension(230, 159);
pd4ml.setPageSize(dimension);
Insets insets = new Insets(0, 0, 0, 0);
pd4ml.setPageInsets(insets);
pd4ml.setHtmlWidth(width);
…..
pd4ml.render(isr, baos, url);
-
AuthorPosts