You probably need to javaCast the '12' to whatever type that the API requires.

What is the API for the setFontAndSize()?

Mark

On 6/19/07, James Buckingham <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> Does anybody know why the following code is telling me that the method 
> fontandsize() doesn't exist?
>
> ----------------
>
>         myObj = structNew();
>         local = structNew();
>
>         myObj.document = CreateObject("java", "com.lowagie.text.Document");
>         myObj.fileIO = CreateObject("java", "java.io.FileOutputStream");
>         myObj.pdfWriter = CreateObject("java", 
> "com.lowagie.text.pdf.PdfWriter");
>         myObj.vertText = 
> createObject("java","com.lowagie.text.pdf.VerticalText");
>         myObj.pdfContentByte = 
> createObject("java","com.lowagie.text.pdf.PdfContentByte");
>
>         myObj.BaseFont = createObject("java","com.lowagie.text.pdf.BaseFont");
>         local.bf = myObj.BaseFont.Courier;
>
>         // create a 'Document' object
>         myObj.document.init();
>         // get an outputstream for the PDF Writer
>         // call the constructor, pass the location where you want the pdf to 
> be created
>         
> myObj.fileIO.init("C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\pdfWriter\pdf\test.pdf");
>         // call the static 'getInstance' factory method
>         local.writer = myObj.pdfWriter.getInstance(myObj.document, 
> myObj.fileIO);
>         // open the document
>         myObj.document.open();
>
>         local.cb = local.writer.getDirectContent();
>
>         local.cb.beginText();
>         local.cb.setFontAndSize(local.bf, 12);
>         local.cb.showTextAligned(1, 'THIS IS A TEST', 100, 100, 0);
>         local.cb.endText();
>
> -------------
>
> Error Message is:
>
> The selected method setFontAndSize was not found.
> Either there are no methods with the specified method name and argument 
> types, or the method setFontAndSize is overloaded with arguments types that 
> ColdFusion can't decipher reliably. If this is a Java object and you verified 
> that the method exists, you may need to use the javacast function to reduce 
> ambiguity.
>
> The error occurred in 
> C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\pdfWriter\index.cfm: line 32
>
> 30 :    
> myObj.fileIO.init("C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\pdfWriter\pdf\test.pdf");
> 31 :    // call the static 'getInstance' factory method
> 32 :    local.writer = myObj.pdfWriter.getInstance(myObj.document, 
> myObj.fileIO).setFontAndSize('Courier', 12);
> 33 :    // open the document
> 34 :    myObj.document.open();
>
> ----------------
>
> Yet when I dump the writer methods I can see the setFontAndSize method 
> sitting in the listing.
>
> I've updated my iText.jar to the latest version (2.0.4) and that hasn't fixed 
> the problem either :(
>
> Cheers,
> James
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281457
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