Forum Replies Created
-
AuthorPosts
-
in reply to: HTML/CSS rendering issues November 11, 2013 at 14:45#26885
No, I am also searching for this
in reply to: Can’t Get Image Max-width and Max-Height to Work November 12, 2013 at 07:08#29403@PD4ML wrote:
For the time being the CSS property is not supported. See http://pd4ml.com/css.htm
Please request the feature by support pd4ml com email.
in reply to: HTML/CSS rendering issues November 12, 2013 at 13:34#26887With css
<br /> <style rel="stylesheet" type="text/css"><br /> <br /> .element p.text<br /> {<br /> color:#0000ff;<br /> font-size:20px;<br /> }<br /> <br /> </style><br /> <br /> <style rel="stylesheet" type="text/css"><br /> <br /> .element.etext p<br /> {<br /> color:#ff0000;<br /> font-size: 10px;<br /> }<br /> <br /> .element p.text<br /> {<br /> font-size:50px;<br /> color:#00ff00;<br /> font-family:Courier, monospace;<br /> }<br /> <br /> </style><br />
and html
<br /> <div class="element compatibility etext full left text " ><br /> <p class="text"><br /> What should be my font size?<br /> </p><br /> </div><br />
Browser shows big green text but pdf output has small red. If I remove the first .element p.text selector then output pdf has also green big text.
Is the rest of the selectors just skipped if there is more than one selector of same name? Or why the settings of the later one doesn’t get applied?
PD4ML 3.8.0 fx 4 in use but I have also tried with 3.8.5 fx 2 demo.
Demo html and result pdf attached in zip.
Thanks in advance,
Kallein reply to: HTML/CSS rendering issues November 12, 2013 at 22:23#26888Hi
I am evaluating pd4ml and find that images are a bit blurred. When I turn debug info on I get this warning:
“Not embeddable color type. Reformatting image…”
I could not find info about this anywhere. Could you please tell me what might cause it? What are the supported embeddable color types? My image is png.
Thank you
in reply to: Not embeddable color type. Reformatting image… November 13, 2013 at 13:34#29433The message is not fatal, it only means the image cannot be embedded to PDF “as is”, and needs to be converted to an internal PDF image format. However, of course, a conversion takes CPU resources and a resulting PDF slightly grows.
PNG has some requirements in order to be embeddable: if should be 8 bit, not be interlaced and not have a transparency mask and translucency layer.
In the code below colorType==3 refers to PNG8, otherwise it is PNG24
[language=java:22arj1xh]…
if ( bitDepth > 8 ) {
if ( debug ) {
System.err.println( “can not embed ” + fileName +
“. PNG should not have more than 256 colors. Reformatting image…” );
}
unsupportedType = true;
}if ( colorType > 3 ) {
if ( debug ) {
System.err.println( “can not embed ” + fileName +
“. Not embeddable color type. Reformatting image…” );
}
unsupportedType = true;
}if ( interlaceMethod > 0 ) {
if ( debug ) {
System.err.println( “can not embed ” + fileName +
“. Interlaced PNG are not embeddable. Reformatting image…” );
}
unsupportedType = true;
}[/language:22arj1xh]in reply to: Can’t Get Image Max-width and Max-Height to Work November 13, 2013 at 19:47#29404The feature will be available with v385fx3 release in few days
in reply to: Troubleshooting November 15, 2013 at 10:59#26886Hi there,
I have some complex problem here with pd4ml 385fx2.
I am using pd4ml by the taglib approach rendering a pdf file.
The file contains a img tag which is refering to a Servlet which returns an BufferedImage (a barcode generated on the fly).
Without this call the pdf renders perfectly – with the call the pdf won’t be shown by the internal pdf viewer of firefox version 25. If I ‘download’ the pdf an open it via Acrobat Reader the pdf is shown perfectly.
So, only the BufferedImage prevents the pdf from beeing displayed by firefox’s internal pdf viewer.
Here is the code returned on the JSP of the called Servlet:
<br /> response.setContentType("image/png");<br /> BufferedImage image = getMyBufferedImage();<br /> OutputStream os = response.getOutputStream();<br /> ImageIO.write(image, "png", os);<br /> os.close();<br />
I think the ImageIO.write statement has some downfalls with pd4ml.
Any quick help?
Thanks
in reply to: BufferedImage via ImageIO not schow in firefox preview November 15, 2013 at 11:12#29425Could you please publish such PDF sample?
in reply to: BufferedImage via ImageIO not schow in firefox preview November 15, 2013 at 11:40#29426@PD4ML wrote:
Could you please publish such PDF sample?
The file is too big to attach it to this thread. Here is the link instead: http://bit.ly/I35Vio
in reply to: HTML/CSS rendering issues November 15, 2013 at 13:21#26889Hey,
I am using PD4ML (version: PD4ML 380fx8b1 Pro DMS) for my web app and i tried to use div:nth-child(odd|even) pseudo-css selector but somehow at time of pdfml.render() is throwing nullpointer exception from ss_css2.jar classes. Please check below mentioned exception and details. Please help.
As you mentioned like below on : http://pd4ml.com/cookbook/pd4ml_proprietary_css_features.htm
E:first-child The :first-child pseudo-class Matches element E when E is the first child of its parent
E:nth-child(even|odd) Structural pseudo-class selector Matches E element, the even or odd child of its parentStyle sheet that i am using in html :
You can also try W3Schools example and it’s not working.
http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_nth-childMy Sample Java Codes to generate PDF from HTML.
<%@ page import="java.io.*,java.net.*,java.util.*,org.zefer.pd4ml.*"%>
<% String sBodyHTML = "AAA"; if (null != request.getParameter("html")) sBodyHTML = request.getParameter("html"); PD4ML pd4ml = new PD4ML(); Mapmap = new HashMap ();
map.put(“pd4ml.cache.enable”, “false”);
pd4ml.setDynamicParams(map);
pd4ml.setPageSize(PD4ML.LETTER);
pd4ml.setPageInsets(new java.awt.Insets(18, 18, 18, 18));
pd4ml.adjustHtmlWidth();ByteArrayOutputStream baos = new ByteArrayOutputStream();
pd4ml.render(new StringReader(“PD4ML using pt ” + sBodyHTML + ““), baos);
byte[] result = baos.toByteArray();
response.setContentType(“application/pdf”);
response.setHeader(“Content-disposition”, “inline; filename=test” + Math.random() + “.pdf”);
if (!request.isSecure()) {
response.setHeader(“Pragma”, “no-cache”);
response.setHeader(“Expires”, “-10000”);
}
response.setContentLength(result.length);
ServletOutputStream sos = response.getOutputStream();
sos.write(result);
%>Exception :
Caused by: java.lang.NullPointerException
at org.w3c.css.sac.CSSParseException.(Unknown Source)
at com.steadystate.css.parser.SACParser.pseudo(Unknown Source)
at com.steadystate.css.parser.SACParser.simpleSelector(Unknown Source)
at com.steadystate.css.parser.SACParser.selector(Unknown Source)
at com.steadystate.css.parser.SACParser.selectorList(Unknown Source)
at com.steadystate.css.parser.SACParser.styleRule(Unknown Source)
at com.steadystate.css.parser.SACParser.styleSheetRuleList(Unknown Source)
at com.steadystate.css.parser.SACParser.styleSheet(Unknown Source)
at com.steadystate.css.parser.SACParser.parseStyleSheet(Unknown Source)
at org.zefer.html.doc.css.CssParser.parseStyleSheet(CssParser.java:56)
at org.zefer.html.doc.css.CssRuntime.parseStyle(CssRuntime.java:159)
at org.zefer.html.doc.PD4MLHtmlParser.buildDocument(PD4MLHtmlParser.java:368)
at org.zefer.pd4ml.PD4ML.render(PD4ML.java:1649)
at org.zefer.pd4ml.PD4ML.render(PD4ML.java:383)
at org.apache.jsp.egn.public_.tests.html2pdf_jsp._jspService(html2pdf_jsp.java:86)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
… 28 morePlease let me know if you are looking for more info.
Thanks.
in reply to: CSS Selector parsing Error (div:nth-child/pseudo selector) November 15, 2013 at 14:50#29434W3Schools example defines p:nth-child(2), which is not supported by the current versions of PD4ML. If you change it, for an instance, to p:nth-child(odd) – it renders correctly.
Also I added your style to my test document and it caused no CSS exception.
I used PD4ML v385fx2. So I would recommend to give a try to the newest version (and accompanying ss_css2.jar) – there are fully functional trials available for download.
in reply to: BufferedImage via ImageIO not schow in firefox preview November 15, 2013 at 14:57#29427Hmm… The PDF seems to be not corrupted and there is no leading-trailing garbage. I tested it with Firefox 25 (on Mac) – no problems.
Are there any exceptions or error messages originated by PD4ML in server’s log?
I would also recommend to inspect HTTP header returned with the PDF for cases without and with PNG.
in reply to: CSS Selector parsing Error (div:nth-child/pseudo selector) November 15, 2013 at 15:31#29435Hey,
Thanks for the quick reply. Ok I got you but can you please test it once with version “PD4ML 380fx8b1 Pro DMS” because as per your docs
New in PD4ML Pro 3.6.1b2
RTF file format output support
nth-child(even|odd) CSS selector supportyou are supporting it from version “PD4ML Pro 3.6.1b2”.
Thanks
in reply to: CSS Selector parsing Error (div:nth-child/pseudo selector) November 15, 2013 at 15:36#29436I suspect you use ss_css2.jar from an old version. Replace it with a one taken from 380fx8b1 or, which is better, from (trial) 385fx2. It is an open source lib, we patch it from time to time.
in reply to: BufferedImage via ImageIO not schow in firefox preview November 15, 2013 at 15:39#29428That is strange because on all our systems (firefox 25 on mac and win7) the pdf returned by the above link opens the internal firefox pdf viewer but after loading the pdf (white bar on top of the viewer) the pdf is not shown. only the direct download – out of the viewer – shows the correct pdf.
Did you just download the pdf or did it also opened fully in the internal ff pdf viewer on you system?
Response header with embedded png:
<br /> HTTP/1.1 200 OK<br /> Date: Fri, 15 Nov 2013 15:17:54 GMT<br /> Server: Apache/2.0.59 (Win32) mod_ssl/2.0.59 OpenSSL/0.9.7l<br /> Content-Length: 2209665<br /> Expires: Thu, 01 Dec 1994 16:00:00 GMT<br /> Content-Disposition: inline; filename=antrag_partnercard.pdf<br /> Accept-Ranges: bytes<br /> Keep-Alive: timeout=15, max=100<br /> Connection: Keep-Alive<br /> Content-Type: application/pdf<br />
Response header without embedded png:
<br /> HTTP/1.1 200 OK<br /> Date: Fri, 15 Nov 2013 15:28:41 GMT<br /> Server: Apache/2.0.59 (Win32) mod_ssl/2.0.59 OpenSSL/0.9.7l<br /> Content-Length: 2207685<br /> Expires: Thu, 01 Dec 1994 16:00:00 GMT<br /> Content-Disposition: inline; filename=antrag_partnercard.pdf<br /> Accept-Ranges: bytes<br /> Keep-Alive: timeout=15, max=100<br /> Connection: Keep-Alive<br /> Content-Type: application/pdf<br />
Sometimes I get the array index out of bounds exceptions stated in the attached file – but not always…
Btw: is it possible to tell pd4ml to set the content-disposition to “attachment”? like this we could work around the pdf viewer and the browser would open the pdf directly, wouldn’t it?
-
AuthorPosts