iText & creating PDF on the fly

megan

Perch
Hello - I realize that we will not be going to CF 7 any time soon and I can live with that. However one of the things that I was interested in with CF 7 was the new cfdocument tag and the ability to create pdf's on the fly

recently someone posted over at easycfm about using iText (http://www.lowagie.com/iText/) to create PDF's on the fly

(post is at http://www.easycfm.com/forums/viewmessages.cfm?Forum=8&Topic=10035 ) and the example code posted for implementation is:

snip>>>
============================================
<cfscript>
thispath = ExpandPath("*.*");
currDir = GetDirectoryFromPath(thispath);
finalOutPutFile="brochure_printer_test.pdf"; // new output file
//create a paragraph object.
paragraph = createObject("java","com.lowagie.text.Paragraph");
//1. create document object
pdfDocument=createObject("java","com.lowagie.text.Document");
//initialize the pdfDocument
pdfDocument.init();
//create file output stream
newPDF=createObject("java","java.io.FileOutputStream").init(expandPath(finalOutPutFile));
//2. create pdfWriter Instance
pdfWriter = createObject("java","com.lowagie.text.pdf.PdfWriter");
//associate pdfDocument with pdfWriter
PdfWriter.getInstance(pdfDocument, newPDF);
//3. open document object
pdfDocument.open();
//4. write data into pdf document goes Here ............
paragraph.init("Hello world.");
//write paragraph in the document.
pdfDocument.add(paragraph);

//5. close pdf stream
pdfDocument.close();
</cfscript>

Done......

<!--- Uncomment the given below line TO Show the Generated Pdf --->
<cfcontent type="application/pdf" file = "#currDir#brochure_printer_test.pdf" deleteFile = "no">
==============================================

now here is my question - is iText available for use here ?? or is it possible to have it installed so that it would be available to use ???

thanks, megan
 
Hi - I haven't heard anything back, so I guess either it is a "no" or they just haven't had time :(

~Megan
 
iText is on winCF2 now, but I must reboot it for the classpath settings to work, after that you should be able to utilize it.

I will post a reboot for tonight on the network status forum.
 
Going to see how it works on wincf2 and then will make that decision :)

If it works well, it will be available yes.

just fyi iText is what the adobe pdf creation built into CFMX7 is, its just itext sent with CFMX7 by default with a tag name.
 
Back
Top