iText & creating PDF on the fly

Discussion in 'Cold Fusion MX' started by megan, Sep 11, 2006.

  1. megan

    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
  2. Rossv1

    Rossv1 Perch

    This looks like a good alternative...did you ever get a reply to this?
  3. megan

    megan Perch

    Hi - No, You're the first person to reply ;P ~megan
  4. Stephen

    Stephen US Operations Staff Member

    this is the first time for me to see this post I will check it out :)
  5. hatton

    hatton Perch

    Any update on this?
  6. megan

    megan Perch

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

    ~Megan
  7. hatton

    hatton Perch

    It's been a while on this, has there been a decision made at this time?
  8. manopb

    manopb Perch

    I too could put this feature to work if available.:)
  9. Stephen

    Stephen US Operations Staff Member

    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.
  10. manopb

    manopb Perch

    Any chance to get this on Wincf?
  11. Stephen

    Stephen US Operations Staff Member

    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.

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services