• Not Working

    By Robert E McDonald 1 decade ago

    This solution is perfect for a project I'm working on, but I simply cannot get the sample database to work from my 8.5.3 client or my XWork server.  To make sure I don't have a fundamental problem I tried working with the code below and it works fine by using the itext 5.1.1.jar file.  However, I cannot get this database with the itext 2.1.7.jar file to work at all.

     

     

    // Load the java packages
    
    importPackage(com.itextpdf);
    
     
    
    //Initialization
    
    var con = facesContext.getExternalContext();
    
    var response:com.ibm.xsp.webapp.XspHttpServletResponse = con.getResponse();
    
     
    
    //setting response headers for browser to recognize data
    
    response.setContentType("application/pdf");
    
    response.setHeader("Cache-Control", "no-cache");
    
    response.setDateHeader("Expires", -1);
    
    response.setHeader( "Content-Disposition", "attachment; filename=\"export.pdf\"" );
    
     
    
    // Setup the PDF Output Stream
    
    var newPDF:com.itextpdf.text.Document = new com.itextpdf.text.Document();
    
    var writer = com.itextpdf.text.pdf.PdfWriter.getInstance(newPDF,response.getOutputStream());
    
     
    
    // Open the PDF and write the PDF header info
    
    newPDF.open();
    
    newPDF.addAuthor("Rob McDonald");
    
    newPDF.addCreationDate();
    
    newPDF.addCreator("IBM XWork V8.5.3 : XPages iText Library");
    
    newPDF.addTitle("PDF Export Demo");  
    
     
    
    // Write The Contents To the PDF
    
    newPDF.add(new com.itextpdf.text.Paragraph("Hello world"));
    
     
    
    // Finish
    
    newPDF.close();
    
    writer.close();
    
    facesContext.responseComplete();
    
    • error message?

      By Rami Muurimäki 1 decade ago

      That's vierd since the whole control is designed using the iText 2.1.7 version (and not the 5.1 family). The reason to use the older version is only the licensing problems (LGPL vs. AGPL).

      What kind of error message you get? Can't really help you without it? I have tested and actually I'm using this very same control in my current project and there we are using iText 2.1.7. version. Haven't tested this with the XWork server, but I assume that this won't cause any problems, it's still a Domino server.

      Rami