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



Nov 25, 2011, 7:17 AM
37 Posts

Pdf and richtext item

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: pdf,richtext
  • Replies: 5
I need to create PDF file from my Web Xpages Form that contains a RichText Item.
 
 
But don't support Richtext for now....
 
I see that is possible insert HTML into a special field with Adobe Acrobat Designer tool
 
 
And I see this Jboss implementation based JSF:
 
  
 
Someone have any suggest for me?
 
How Can I capture the HTML code into ckeditor component after getComponet("richText") ?
 
Tnx
 
p.s. In release 8.5.3  what's the Itext version supported?
 
Nov 25, 2011, 8:46 AM
54 Posts
Re: Pdf and richtext item
If the PDF design is simple enough, you can create the whole PDF "on the fly".
See this video here http://notesin9.com/index.php/2011/10/23/notesin9-ee-012-creating-pdfs-from-xpages/
 
I think they even share an example of how to add content from HTML?
 

Nov 25, 2011, 12:31 PM
37 Posts
Re: Pdf and richtext item
 
Hi ..I have used this Enkory solutions:
----------------------------------------------------------------- 
importPackage(com.itextpdf);
importPackage(java.io);

try{
var con = facesContext.getExternalContext();
var response:com.ibm.xsp.webapp.XspHttpServletResponse = con.getResponse();

response.setContentType("application/pdf");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", -1);
response.setHeader( "Content-Disposition", "attachment; filename=\"test.pdf\"" );

var newPDF:com.itextpdf.text.Document = new com.itextpdf.text.Document();
var writer = com.itextpdf.text.pdf.PdfWriter.getInstance(newPDF,response.getOutputStream());
var htmlWorker = new com.itextpdf.text.html.simpleparser.HTMLWorker(newPDF);

newPDF.open();
newPDF.addAuthor("xxxx");
newPDF.addCreationDate();
newPDF.addCreator("IBM Lotus Domino V8.5.3 :iText Library");
newPDF.addTitle("PDF Demo");

var str=getComponent("RICHTEXTFIELD").getValue().toString();
htmlWorker.parse(new java.io.StringReader(str));
// Finish
newPDF.close();
writer.close();
facesContext.responseComplete();
}
catch(e)
{
         log.logError( e.toString(), null, e ); //Write in OpenLog
}
 
But I have problem to convert Font on my RichText into PDF ?
Now I see  flying-saucer

Have you any suggest? 
 
Nov 25, 2011, 12:41 PM
54 Posts
Re: Pdf and richtext item
I tried also the flyingsaucer but didn't manage it to work propertly - it requires pure DHTML and as far as I know, Domino does not provide pure DHTML. I studied it only during one day and gave up. The idea in that project is great.
Nov 25, 2011, 2:38 PM
37 Posts
Re: Pdf and richtext item SOLVED!
I'have found a SOLUTIONS!!!
 
Is need this JAR...XMLWORKER.JAR
 
http://sourceforge.net/projects/xmlworker/
 
Now the fonts style work very vell!!!
 
But Now I need to understand how transcoding URL Image Uploaded in CKeditor..because the URL CHANGE for every user:
 
For example:
 
/hostname/xsp/.ibmmodres/persistence/DominoDoc-33-Body/ManageError_1322230051777.jpeg
 
Nov 28, 2011, 6:18 AM
54 Posts
Re: Pdf and richtext item
Too bad that it requires the iText version 5.1.2. That version of iText has a bit "aggressive" open source license (AGPL if I remember it correctly).
The PDF Exporter Custom Control (openntf) is based on the older iText version 2.1.7 which uses MPL/LGPL license.

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