Forum Replies Created
-
AuthorPosts
-
in reply to: Browser error "File does not begin with ‘%PDF-‘" June 17, 2009 at 16:37#27221
JSP is text output oriented environment. PD4ML taglib outputs binary data, where file start markers and the document structure (PDF object offsets integrity) is very important.
If there is some content before
<pd4ml:transform>tag, the undesired content is sent directly to client’s browser, before<pd4ml:transform>outputs the binary PDF data starts with “%PDF-“.Another possible reason: PD4ML failed (let’s say ss_css2.jar library is missing) but “Content-type: application/pdf” HTTP header is already sent. Adobe Reader plugin launched and tries to interpret the received data, however actually the data is not PDF bytes, but Java exception stack trace text.
In any case a good starting point of the problem analyze is to add enable=”false” attribute to
<pd4ml:transform>, to make sure that HTML passed to PD4ML is correct.in reply to: Troubleshooting June 19, 2009 at 19:52#26213Hello,
I am ejecuting the demo PHP application and I get the following error in stderr.txt file
(.:4214): Gtk-WARNING **: cannot open display:What did I miss?
Any help would be apreciated.
Thanks
in reply to: Gtk-WARNING: cannot open display: June 20, 2009 at 17:47#27345Obviously you run PD4ML on Linux or UNIX platform.
In the case make sure that -Djava.awt.headless=true JVM command-line parameter is set. The “headless” mode prevents Java from attempts to connect/use “display resources”. It is important for server environments: as a rule they do not assume any connected display hardware.
in reply to: General questions / FAQ June 22, 2009 at 15:41#26214Is there a way to append pd4ml rendered pdf as a new page in an existing pdf file?
Alternately, create a new pdf with content from existing pdf and then append pd4ml rendered content?
in reply to: Deployment / Configuration issues June 23, 2009 at 21:58in reply to: Troubleshooting June 24, 2009 at 15:54#26216I try to use generatePdfForms() to create PDF form input box in the generated PDF file. However it doesn’t work. Here is my code:
PD4ML pd4ml = new PD4ML(); pd4ml.setPageInsets( new Insets( 20, 10, 10, 10 ) ); pd4ml.setHtmlWidth( 950 ); pd4ml.setPageSize( format ); pd4ml.generatePdfForms( true, null ); ...
HTML code is:
<input id="_id5:_id61" name="_id5:_id61" type="text" value="s" size="30" />in reply to: Troubleshooting July 1, 2009 at 12:14#26217Hi,
Everytime my HTML source code contains an image I get the following error:
image not yet in cache: file:../images/barrreMenu_bleu.jpg
not yet in cache: file:../images/barrreMenu_bleu.jpg
..imagesbarrreMenu_bleu.jpg (Le chemin d’accès spécifié est introuvable)
image file:../images/barrreMenu_bleu.jpg has zero length.
can not load image: ../images/barrreMenu_bleu.jpg“barrreMenu_bleu.jpg” is the name of my image file. It’s a static image. I’ve same problem for every images.
I’ve same problem with dynamical image cretaed by JFreeChart.
Can you help me please ?
in reply to: Images cannot be loaded July 2, 2009 at 08:16#27350Obviously PD4ML has no info about URL base of the document and it cannot resolve the relative path to an absolute one.
A possible reason – you render the HTML to PDF with
render(java.io.StringReader isr, java.io.OutputStream os)
and the document has no<base>tag.A solution is to use
render(java.io.StringReader isr, java.io.OutputStream os, java.net.URL base)instead.
If the explanation does not match your PD4ML usage scenario, please provide more info.
in reply to: Disable the CSS and Images cache. July 2, 2009 at 08:24#27348There is a couple of approaches to disable caching.
1. Set an environment variable (add the following to JVM command line):
-Dpd4ml.cache.enable=false( the same from Java/JSP code if JVM security policy allows: System.setProperty(“pd4ml.cache.enable”,”false”) )
or via PD4ML API call:
HashMap map = new HashMap(); map.put("pd4ml.cache.enable","false") ; pd4ml.setDynamicParams(map);2. Another method is to add a random suffix to CSS URL:
(JSP sample)
<% String suffix = ""; if ( debug ) { suffix = "?dummy=" + generateRandom(); } %> <link rel="stylesheet" type="text/css" href="xstyle.css" />in reply to: HTML/CSS rendering issues July 2, 2009 at 08:37#26218Hi,
I am using a web Application on TOmcat 6.0.14. I passed the URL into the render function.
The code is as follows.public void generatePdfInvoice(HttpServletRequest request , HttpServletResponse response) throws Exception{
StringBuffer filename = request.getRequestURL();System.out.println(“The request URL is: ” + filename.toString());
String file = filename.toString();
File outputPDFFile = new File(“D://Stored_Invoices/Inv_no_” + this.getInvoiceID() + “.pdf”);
String inputHTMLFileName = file + “?cmd=print&invoice_id=” + this.getInvoiceID();
//URL url = new URL(“filename”);
Dimension format = PD4Constants.A4;
java.io.FileOutputStream fos = new java.io.FileOutputStream(outputPDFFile);
PD4ML pd4ml = new PD4ML();
pd4ml.setPageInsets(new Insets(20, 10, 10, 10));
pd4ml.setHtmlWidth(1000);
pd4ml.setPageSize(pd4ml.changePageOrientation(format));
pd4ml.enableDebugInfo();
pd4ml.render(inputHTMLFileName, fos);It is giving the following error:
java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8084/ManglamProj/vtsInvoice2.jsp?cmd=print&invoice_id=980
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1298)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1292)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:948)
at org.zefer.cache.c.getResourceAsBytes(Unknown Source)
at org.zefer.html.doc.PD4MLHtmlParser.parse(Unknown Source)
at org.zefer.html.doc.PD4MLHtmlParser.buildDocument(Unknown Source)
at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)
at org.zefer.pd4ml.PD4ML.render(Unknown Source)What to do????
in reply to: Images cannot be loaded July 2, 2009 at 09:53#27351Thank you for your response.
I can now load all my statics images, but I can’t load dynamical images created by JFreeChart.
I include those images in my JSP by a call to the DisplayChart servlet provided by the JFreechart library. The syntax of this call is :
request.getContextPath() + “/servlet/DisplayChart?filename=” + filename
thanks for your help
in reply to: Images cannot be loaded July 2, 2009 at 10:26#27352In that case PD4ML cannot resolve the web app context (request.getContextPath()) to anything “loadable” – to an absolute path or full URL.
Try to pass servet context to PD4ML – it should help to load the dynamic resource:
useServletContext(ServletContext ctx)in reply to: Images cannot be loaded July 2, 2009 at 11:19#27353Thanks.
I’ve already added this piece of code.
But I’ve found the problem: it comes from the DisplayChart code of JFreechart.
It needs some little changes to work with pd4ml.Since I find this, my company (service from french government) can buy a licence of your product.
regards,
in reply to: PD4ML Tips & Tricks July 4, 2009 at 12:11#26219when i add a large image with content then my image is splite in between two pages so give me solution of image splite
in reply to: HTML/CSS rendering issues July 6, 2009 at 17:08#26220I am facing a problem when the HTML to export contains different images, I mean, if the HTML contains jpg, png or gif files. Some of those images are not exported correctly in the PDF, but not always the same images fails.
Is this an unfixed issue?
Thanks.
-
AuthorPosts
