This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 20, 2011, 5:37 PM
38 Posts
topic has been resolvedResolved

iText + XPages

  • Category: Other
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: iText,xpages
  • Replies: 4
I am trying to generate PDF file from XPages. For this purpose I am using iText version 2.1.7.
 
The code in SSJS is   

var newPDF:com.lowagie.text.Document = new com.lowagie.text.Document();   <---   Line number 69

var writer = com.lowagie.text.pdf.PdfWriter.getInstance(newPDF,response.getOutputStream());

But the code gives error: 
com.ibm.jscript.InterpretException: Script interpreter error, line=69, col=61: Reference error: 'com' not found
 
Any ideas!!?? 
May 20, 2011, 5:58 PM
23 Posts
Re: iText + XPages
I have some working iText code and I used the following:
 
new com.itextpdf.text.Document();

Are you sure you have the iText jar file in your build path?
 
 
May 23, 2011, 4:28 PM
38 Posts
Re: iText + XPages
 Yes, I have included the JARs in the Build path (Referenced Libraries). 
 
This code  
 
try {
print("1");
importPackage(com.lowagie);
print("2");
var newPDF:com.lowagie.text.Document = new com.lowagie.text.Document();
print("3");
var writer = com.lowagie.text.pdf.PdfWriter.getInstance(newPDF, 
facesContext.getExternalContext().getResponse().getOutputStream());
print("4");
} catch (e) {
print("Error: " + e.toString());
}
 
produces this output 

HTTP JVM: 1
HTTP JVM: 2
HTTP JVM: Error: com.ibm.jscript.InterpretException: Script interpreter error, line=5, col=69: Reference error: 'com' not found 
 
I am using iText 2.1.7. I guess you are using iText 5 (as your code suggests). I even tried that using the example given in this link: 
But no success. Is there I need to do something on the server?  I am really not able to get past this one?? Please help!!
 
Additional information: 
- Domino Designer Release 8.5.1FP5  
- Trying it on localhost 
- For iText 2.1.7 included only one JAR : iText-2.1.7 
- For iText 5.1.0 included this JAR : itextpdf-5.1.0 & itext-xtra-5.1.0 
May 26, 2011, 6:46 AM
170 Posts
Re: iText + XPages
 I tried the same thing on a 8.5.2 server and client and I had no problems 
 
1. Created a sub folder in the web-inf folder called lib 
2. right clicked on that folder and selected Bild path -> and Configure build path
3. on tab libraries, selected add jar. and picked the compiled version of itext 2.1.7 not the source one. 
4. Copied and pasted the source found below onto the click event behind a button. 
5. Changed all places with itextpdf to lowagie using find and replace
 
Saved the XPage and tested it from a webbrowser 
 
May 26, 2011, 7:02 AM
5 Posts
Re: iText + XPages
Hello Naveen Maurya, I generated pdf using itext. Helped me this link: http://blog.redturtle.it/redturtle-blog/generating-pdf-with-itext-and-xpages


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal