Re: iText: The selected method setFontAndSize was not found.
That's absolute perfect thanks for your help everyone. James ~| ColdFusion MX7 and Flex 2 Build sales & marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281701 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: iText: The selected method setFontAndSize was not found.
nm - darn lag! ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281490 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: iText: The selected method setFontAndSize was not found.
You're passing the wrong object types. The API is setFontAndSize(com.lowagie.text.pdf.BaseFont, float). >> myObj.BaseFont = createObject("java","com.lowagie.text.pdf.BaseFont"); >> local.bf = myObj.BaseFont.Courier; BaseFont.Courier is a string. What you need is a BaseFont object. Try using the FontFactory class or BaseFont.createFont(...) //FontFactory myObj.FontFactory = createObject("java","com.lowagie.text.FontFactory"); local.bf = myObj.FontFactory.getFont(myObj.FontFactory.COURIER).getBaseFont(); //createFont() myObj.BaseFont = createObject("java","com.lowagie.text.pdf.BaseFont"); local.bf = myObj.BaseFont.createFont(myObj.BaseFont.COURIER, myObj.BaseFont.CP1252, myObj.BaseFont.NOT_EMBEDDED); Then use javacast on the size like Mark mentioned. //cast the size as a float local.cb.setFontAndSize(local.bf, javacast("float", 12)); ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281488 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: iText: The selected method setFontAndSize was not found.
Mark Mandel wrote: > You probably need to javaCast the '12' to whatever type that the API requires. naw, it's the font (static numbers should almost always go through ok--though i use a java lib that even wants strings cast). he's set it to a string ("Courier"). >> local.bf = myObj.BaseFont.Courier; got to go the extra mile: BaseFont=createObject("java", "com.lowagie.text.pdf.BaseFont"); bf=baseFont.createFont(BaseFont.COURIER,BaseFont.CP1252,BaseFont.EMBEDDED); // or whatever ~| CF 8 â Scorpio beta now available, easily build great internet experiences â Try it now on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281487 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: iText: The selected method setFontAndSize was not found.
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
iText: The selected method setFontAndSize was not found.
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 ~| Macromedia ColdFusion MX7 Upgrade to MX7 & experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281448 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4