Re: More iText RTF Questions [bayes SPAMTRAP]
Loathe wrote: I've got it working, now I need to figure out how to do formatting and alignment. iText is sometimes a bit too atomic when it comes to formatting (the cfteam did a great job taking much of the sweat out of using iText) but every object has alignment properties: pageNumber.setAlignment(paragraph.ALIGN_RIGHT); and you can tweak it to an insane level. Still working out page numbers http://pastebin.com/m3e0ff845 set the rtfPageNumber field on the rtfWriter2 not on the doc. ~| 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:307383 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: More iText RTF Questions [bayes SPAMTRAP]
Bit by bit it's coming together for sure. While I've got your attention :) I'm getting some weird behavior. it seems to be producing a question mark (?) at weird intervals and I can't tell why. Also, the actual text of the document is produced from html entered through fckEditor. When I drop my fields in here it seems to ignore or escape the html to the page, how should I handle that? Currently I'm simply removing all HTML tags with a regular expression, the problem comes in when the field contains multiple blocks of text separated with br /. How would I make it recognize a space there? Paul Hastings wrote: Loathe wrote: I've got it working, now I need to figure out how to do formatting and alignment. iText is sometimes a bit too atomic when it comes to formatting (the cfteam did a great job taking much of the sweat out of using iText) but every object has alignment properties: pageNumber.setAlignment(paragraph.ALIGN_RIGHT); and you can tweak it to an insane level. Still working out page numbers http://pastebin.com/m3e0ff845 set the rtfPageNumber field on the rtfWriter2 not on the doc. ~| 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:307392 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: More iText RTF Questions [bayes SPAMTRAP]
Loathe wrote: I'm getting some weird behavior. it seems to be producing a question mark (?) at weird intervals and I can't tell why. might be an encoding issue, using any special chars, etc.? anything copy/pasted from word doc? are these showing up if you simply dump the data out to the browser? Also, the actual text of the document is produced from html entered through fckEditor. When I drop my fields in here it seems to ignore or escape the html to the page, how should I handle that? Currently I'm iText's html parsing isn't 100% (ie the package handling this html.simpleparser). you might need to massage the text yourself depending on what html tags are used. simply removing all HTML tags with a regular expression, the problem comes in when the field contains multiple blocks of text separated with br /. How would I make it recognize a space there? not following. you mean regex for whitespace? that's a \s. ~| 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:307396 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: More iText RTF Questions [bayes SPAMTRAP]
By jove I think I've got it :) http://pastebin.com/mb49fe19 I've rewritten it several times now, simplifying the code until I think I have it down to just what I need and it's working just how I want it. Now, I need to figure out the body of this damned thing and I'm there. Paul Hastings wrote: Loathe wrote: I've got it working, now I need to figure out how to do formatting and alignment. iText is sometimes a bit too atomic when it comes to formatting (the cfteam did a great job taking much of the sweat out of using iText) but every object has alignment properties: pageNumber.setAlignment(paragraph.ALIGN_RIGHT); and you can tweak it to an insane level. Still working out page numbers http://pastebin.com/m3e0ff845 set the rtfPageNumber field on the rtfWriter2 not on the doc. ~| 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:307397 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
More iText RTF Questions
All of these questions are in reference to creating RTF docs using iText and RtfWriter2 in ColdFusion called with the javaLoader.cfc 1. How do I create an 8.5 x 11 page? 2. How do I have a 1 margin? 3. How do I create a header that actually displays in the page? 4. How do I add page numbers, after the first page only, in the footer? I've found tutorials and examples online to do all of this in pure java, but I'm having a hell of a time of it trying to convert that into CF. Any help would really be appreciated. ~| 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:307324 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: More iText RTF Questions
Loathe, This is not exactly what you need (this uses iText to write a series of tiff images to a PDF), but it should show you how to use iText with CF! http://pastebin.com/m7187bf8d Chris Peterson -Original Message- From: Loathe [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2008 7:24 AM To: CF-Talk Subject: More iText RTF Questions All of these questions are in reference to creating RTF docs using iText and RtfWriter2 in ColdFusion called with the javaLoader.cfc 1. How do I create an 8.5 x 11 page? 2. How do I have a 1 margin? 3. How do I create a header that actually displays in the page? 4. How do I add page numbers, after the first page only, in the footer? I've found tutorials and examples online to do all of this in pure java, but I'm having a hell of a time of it trying to convert that into CF. Any help would really be appreciated. ~| 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:307325 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: More iText RTF Questions
Excellent example, thanks. I'm at the point where I can output text to the body of the RTF doc. Your example helps with the page type and margins, and helps me wrap my head around how to call the objects. Peterson, Chris wrote: Loathe, This is not exactly what you need (this uses iText to write a series of tiff images to a PDF), but it should show you how to use iText with CF! http://pastebin.com/m7187bf8d Chris Peterson -Original Message- From: Loathe [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2008 7:24 AM To: CF-Talk Subject: More iText RTF Questions All of these questions are in reference to creating RTF docs using iText and RtfWriter2 in ColdFusion called with the javaLoader.cfc 1. How do I create an 8.5 x 11 page? 2. How do I have a 1 margin? 3. How do I create a header that actually displays in the page? 4. How do I add page numbers, after the first page only, in the footer? I've found tutorials and examples online to do all of this in pure java, but I'm having a hell of a time of it trying to convert that into CF. Any help would really be appreciated. ~| 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:307326 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: More iText RTF Questions
Loathe wrote: 1. How do I create an 8.5 x 11 page? pageSize=createObject(java, com.lowagie.text.PageSize).init(); doc=createObject(java,com.lowagie.text.Document).init(pageSize.LETTER,0,0,0,0); 2. How do I have a 1 margin? the 0,0,0,0 bit above are the margins in points. 1=72pt. 3. How do I create a header that actually displays in the page? there's a couple of approaches to this: page events, cfsearching blog has a superb set of posts on itext cf, this one is about page events http://cfsearching.blogspot.com/2008/03/instructions-for-cf-itext.html directContent (ie stick any text/image/etc anywhere on the page): cfscript myObj = structNew(); local = structNew(); BaseFont=createObject(java, com.lowagie.text.pdf.BaseFont); bf=baseFont.createFont(BaseFont.COURIER,BaseFont.CP1252,BaseFont.EMBEDDED); myObj.document=CreateObject(java, com.lowagie.text.Document); newFile=expandPath(test.pdf); myObj.fileIO=createObject(java,java.io.FileOutputStream).init(newFile); 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); // create document myObj.document.init(); // 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(bf, 12.0); local.cb.showTextAligned(1, 'THIS IS A TEST', 100, 100, 0); local.cb.endText(); myObj.document.close(); /cfscript 4. How do I add page numbers, after the first page only, in the footer? see #3. I've found tutorials and examples online to do all of this in pure java, but I'm having a hell of a time of it trying to convert that into CF. porting from bruno's java examples to cf is fairly straightforward. where are you getting stuck? ~| 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:307327 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: More iText RTF Questions
Page events don't work with RTF creation, as the client renders the document when it is opened. That being said there is a footerheader object as part of the rtf writer. I called it, it isn't throwing an error, and I can see my text in the document when opened in notepad, but not in word. The last two posts have really helped me out a lot, let me clean up what I have and see where I am. Thanks man. I've sen you all over the iText forums and mailing list, you seem to be the CF community expert :) Paul Hastings wrote: Loathe wrote: 1. How do I create an 8.5 x 11 page? pageSize=createObject(java, com.lowagie.text.PageSize).init(); doc=createObject(java,com.lowagie.text.Document).init(pageSize.LETTER,0,0,0,0); 2. How do I have a 1 margin? the 0,0,0,0 bit above are the margins in points. 1=72pt. 3. How do I create a header that actually displays in the page? there's a couple of approaches to this: page events, cfsearching blog has a superb set of posts on itext cf, this one is about page events http://cfsearching.blogspot.com/2008/03/instructions-for-cf-itext.html directContent (ie stick any text/image/etc anywhere on the page): cfscript myObj = structNew(); local = structNew(); BaseFont=createObject(java, com.lowagie.text.pdf.BaseFont); bf=baseFont.createFont(BaseFont.COURIER,BaseFont.CP1252,BaseFont.EMBEDDED); myObj.document=CreateObject(java, com.lowagie.text.Document); newFile=expandPath(test.pdf); myObj.fileIO=createObject(java,java.io.FileOutputStream).init(newFile); 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); // create document myObj.document.init(); // 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(bf, 12.0); local.cb.showTextAligned(1, 'THIS IS A TEST', 100, 100, 0); local.cb.endText(); myObj.document.close(); /cfscript 4. How do I add page numbers, after the first page only, in the footer? see #3. I've found tutorials and examples online to do all of this in pure java, but I'm having a hell of a time of it trying to convert that into CF. porting from bruno's java examples to cf is fairly straightforward. where are you getting stuck? ~| 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:307328 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: More iText RTF Questions [bayes SPAMTRAP]
Loathe wrote: That being said there is a footerheader object as part of the rtf writer. I called it, it isn't throwing an error, and I can see my text in the document when opened in notepad, but not in word. post your code. btw cfsearching's not my blog. besides that blog, i recommend anybody working w/iText to cough up the bucks for bruno's book, the eBook's only $30: http://www.manning.com/lowagie/ ~| 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:307330 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: More iText RTF Questions [bayes SPAMTRAP]
http://pastebin.com/m635a3bd4 I've got it working, now I need to figure out how to do formatting and alignment. Still working out page numbers Paul Hastings wrote: Loathe wrote: That being said there is a footerheader object as part of the rtf writer. I called it, it isn't throwing an error, and I can see my text in the document when opened in notepad, but not in word. post your code. btw cfsearching's not my blog. besides that blog, i recommend anybody working w/iText to cough up the bucks for bruno's book, the eBook's only $30: http://www.manning.com/lowagie/ ~| 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:307340 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4