Forum Replies Created

Viewing 15 posts - 46 through 60 (of 4,243 total)
  • Author
    Posts
  • in reply to: Browser error "File does not begin with ‘%PDF-‘"
    #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 tag, the undesired content is sent directly to client’s browser, before 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 , to make sure that HTML passed to PD4ML is correct.

    in reply to: Troubleshooting
    #26213

    Hello,
    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:
    #27345

    Obviously 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
    #26214

    Is 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
    #26215

    I need disable the CSS and Images cache.

    Can it be done?

    in reply to: Troubleshooting
    #26216

    I try to use generatePdfForms() to create PDF form input box in the generated PDF file. However it doesn’t work. Here is my code:

    [language=java:2rgjg0wo]PD4ML pd4ml = new PD4ML();
    pd4ml.setPageInsets( new Insets( 20, 10, 10, 10 ) );
    pd4ml.setHtmlWidth( 950 );
    pd4ml.setPageSize( format );
    pd4ml.generatePdfForms( true, null );
    …[/language:2rgjg0wo]

    HTML code is:
    [language=xml:2rgjg0wo][/language:2rgjg0wo]

    in reply to: Troubleshooting
    #26217

    Hi,

    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
    #27350

    Obviously 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

    [language=java:3s3k01xg]render(java.io.StringReader isr, java.io.OutputStream os)[/language:3s3k01xg]
    and the document has no tag.

    A solution is to use

    [language=java:3s3k01xg]render(java.io.StringReader isr, java.io.OutputStream os, java.net.URL base)[/language:3s3k01xg]

    instead.

    If the explanation does not match your PD4ML usage scenario, please provide more info.

    in reply to: Disable the CSS and Images cache.
    #27348

    There 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:

    [language=java:1kphbjqm]HashMap map = new HashMap();
    map.put(“pd4ml.cache.enable”,”false”) ;
    pd4ml.setDynamicParams(map);[/language:1kphbjqm]

    2. Another method is to add a random suffix to CSS URL:

    (JSP sample)

    [language=xml:1kphbjqm]<%
    String suffix = “”;
    if ( debug ) {
    suffix = “?dummy=” + generateRandom();
    }

    %>
    <link rel="stylesheet" type="text/css" href="xstyle.css” />[/language:1kphbjqm]

    in reply to: HTML/CSS rendering issues
    #26218

    Hi,

    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
    #27351

    Thank 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
    #27352

    In 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:

    [language=java:lrhox354]useServletContext(ServletContext ctx)[/language:lrhox354]

    in reply to: Images cannot be loaded
    #27353

    Thanks.

    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
    #26219

    when 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
    #26220

    I 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.

Viewing 15 posts - 46 through 60 (of 4,243 total)