I need to use iText with ColdFusion (CF) because CFDocument won't do everything I need it to, however I would like to return the result into a CF Variable instead of saving it to a file. It seems that every example out there saves the results to a file.
I'm using the following example code to actually generate a pdf but as I said I need it in a variable (preferably without being a file first) because that variable has to be passed on to code another group has written (and I have no control over).
<cfset var document=createObject("java", "com.lowagie.text.Document") />
<cfset var PageSize = createObject("java","com.lowagie.text.Rectangle") />
<cfset var fileIO = createObject("java","java.io.FileOutputStream") />
<cfset var writer = createObject("java","com.lowagie.text.pdf.PdfWriter") />
<cfset var paragraph = createObject("java", "com.lowagie.text.Paragraph") />
<cfset var FontFactory = createObject("java","com.lowagie.text.FontFactory") />
<cfset var Font = createObject("java", "com.lowagie.text.Font") />
<cfset var Courier = Font.init(Font.COURIER, 8.0) />
<cfset var CourierB = Font.init(Font.COURIER_BOLD, 8.0) />
<cfset PageSize.init(612, 792) />
<cfset document.init(PageSize) />
<cfset fileIO.init("C:\test.pdf") />
<cfset writer.getInstance(document, fileIO) />
<cfset document.open() />
<cfset paragraph.init("Hello world.", Courier) />
<cfset document.add(paragraph) />
<cfset document.close() />
I'm not all that great with Java, just basic knowledge, so this could actually be something simple that I'm not understanding.
Thanks