Once again disregard, I figured it out.

A hello world with RtfWriter2:

<cfset docPath = expandPath("testDoc.rtf")>
<cfset myFile = 
CreateObject("java","java.io.FileOutputStream").Init(CreateObject("java","java.io.File").Init(docPath))
 
/>
<cfscript>
        paths = arrayNew(1);

        /*
        This points to the jar we want to load.
        Could also load a directory of .class files
        */
        paths[1] = expandPath("iText-2.1.2u.jar");
        paths[2] = expandPath("iText-rtf-2.1.2u.jar");


        //create the loader
        loader = createObject("component", "javaloader.JavaLoader").init(paths);
        
        myDoc = loader.create("com.lowagie.text.Document").init();
        myRTF = loader.create("com.lowagie.text.rtf.RtfWriter2");
        thisRTF = myRTF.getInstance(myDoc, myFile);
        myDoc.open();
        myPara = loader.create("com.lowagie.text.Paragraph");
        para = myPara.init("Hello World");
        myDoc.add(para);
        myDoc.close();
        
</cfscript>

Loathe wrote:
> Moving on:
> 
> I have:
> 
> <cfset docPath = expandPath("./testDoc.rtf")>
> <cfset myFile = 
> CreateObject("java","java.io.FileOutputStream").Init(CreateObject("java","java.io.File").Init(docPath))>
> <cfscript>
>       paths = arrayNew(1);
> 
>       /*
>       This points to the jar we want to load.
>       Could also load a directory of .class files
>       */
>       paths[1] = expandPath("iText-2.1.2u.jar");
>       paths[2] = expandPath("iText-rtf-2.1.2u.jar");
> 
> 
>       //create the loader
>       loader = createObject("component", "javaloader.JavaLoader").init(paths);
>       
>       myDoc = loader.create("com.lowagie.text.Document").init();
>       myRTF = loader.create("com.lowagie.text.rtf.RtfWriter2");
>       // myRTF = myRTF.init(myDoc,myFile)
>       // thisRTF = myRTF.getInstance(myRTF, myFile);
> </cfscript>
>               
> <cfdump var="myRTF">
> 
> No I need to instantiate an object of type RtfWriter2 the constructor 
> takes type Document and OutputStream.  I would have though my init() 
> would work but CF says it can't find a constructor that takes these 
> types, what am I doing wrong here?
> 
> Does anyone have a basic hello world example I could take a look at that 
> uses these classes?  Once I can get to having the RtfWriter2 I'm pretty 
> sure I can figure it our the rest of the methods seem pretty easy to use 
> and the lowagie site has some good examples.
> 
> Loathe wrote:
>> Disregard.
>>
>> It's com.lowagie.text.rtf.RtfWriter2
>>
>> Loathe wrote:
>>> Whats the correct path to the RtfWriter2 class?
>>>
>>> I thought it would be  com.lowagie.text.RtfWriter2 but it can't find 
>>> that, I have googled all over the place for it. I've created the 
>>> document object now I need to pass that to RtfWriter2.getInstance() but 
>>> can't seem to instantiate a RtfWriter2 object.
>>>
>>> Any hep would be appreciated, I'm so damned close :)
>>>
>>> Also, how do you find these out?  I assumed there would be some way 
>>> through introspection but can't seem to figure out how to get the info, 
>>> I'm dumping the objects I have but I just get the methods and 
>>> properties, no info on children or super or anything.
>>>
>>> Paul Hastings wrote:
>>>> Loathe wrote:
>>>>> I have a need to be able to create a word document and do page 
>>>>> numbering, and have access to the header and footer to add letterhead 
>>>>> and document classification information.  I'm wondering if anyone can 
>>>>> point me towards a solution that does this other than CF Report Builder?
>>>> have a look at iText's rtfWriter2 class. iText powers cfdocument, etc on 
>>>> cf7 & 
>>>> above so it should just be "there". if you need the latest & greatest 
>>>> version, 
>>>> use mark's javaLoader to load the iText jar for use w/cf.
>>>>
>>>>
>>>>
>>
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307174
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to