

Phrase8 = paragraph.init(“F : #url.fax#”, arial) Phrase7 = paragraph.init(“T : #url.telephone#”, arial) Phrase6 = paragraph.init(“#url.postcode#”, arial) Phrase5 = paragraph.init(“#url.address2#”, arial) Phrase4 = paragraph.init(“#url.address1#”, arial)

Phrase3 = paragraph.init(“#url.clubname#”, arial) Phrase2 = paragraph.init(“#url.jobtitle#”, arial) Phrase = paragraph.init(“#url.name#”, arial) call the static ‘getInstance’ factory method Writer = CreateObject(“java”, “.PdfWriter”) PdfPTable = CreateObject(“java”, “.PdfPTable”) įileIO = CreateObject(“java”, “java.io.FileOutputStream”) įileIO.init(“#expandpath(“test2.pdf”)#”)

PdfPCell = CreateObject(“java”, “.PdfPCell”) Image = CreateObject(“java”, “”) īaseFont = CreateObject(“java”, “.BaseFont”) įont = CreateObject(“java”, “”) Īrial = BaseFont.createFont(#expandpath(“TGL.TTF”)#, BaseFont.CP1252,BaseFont.NOT_EMBEDDED) Rectangle = CreateObject(“java”, “”) Ĭhunk = CreateObject(“java”, “”) Įlement = CreateObject(“java”, “”) ĬMYKcolor = CreateObject(“java”, “.CMYKColor”) ĭocument = CreateObject(“java”, “”).init(pageSize, 0, 0, 0, 0)
#Coldfusion 11 pdf how to#
Have you got any ideas on how to use the table.writeSelectedRows(0, -1, 50, pos, writer.getDirectContent()) as I get an errorĬlass can not access a member of class .PdfWriter with modifiers “protected”
#Coldfusion 11 pdf code#
Thanks for the script – it took me a long way towards my own project, which i’ve included the code for. close the document (PDF Writer is listening and will automaticallyĬopy that code into a cfml page and make sure you’ve downloaded the iText jar to the /lib/ directory of your ColdFusion server and you should be able to create PDF’s in a jiffy!įull source code available here. call the static 'getInstance' factory method Writer = CreateObject("java", ".PdfWriter") call the constructor, pass the location where you wantįileIO.init("C:\\somedir\test.pdf")
#Coldfusion 11 pdf pdf#
get an outputstream for the PDF WriterįileIO = CreateObject("java", "java.io.FileOutputStream") Given that news, you can take the quick example that the author of the iText library gives here to create a PDF in a snap using ColdFusion:ĭocument = CreateObject("java", "") In this case the API designer included a static method ‘getInstance()’ on the PDFWriter class. I guess this statement needs to be amended to include a third possible, but not always valid solution: call a static method on the class which returns an instance of the object in question. In order to access a Java object, you must either a) first call the CreateObject() method and then the init() method, which in the above example, maps to the default constructor in Java, or b) call any nonstatic method on the object, which causes ColdFusion to then instantiate the object for you. … using the CreateObject() function does not get you access to an instance of an object. … The getInstance method is static and according to your July 2003 CFDJ article, you can’t instantiate an object in CF this way. In the email, he mentions that he is trying to use the iText Java-PDF library with ColdFusion MX: Mike Steele sent me an email in reference to an article I wrote for the ColdFusion Developer’s Journal a year or so ago.
