3

I have a PDF that I want to append some text to. the addFooter() that is available in CF9 would work perfectly, but I only have access to CF8.

Any one have workarounds for this feature in 8?

Thanks

Gene R
  • 1,555
  • 5
  • 19
  • 32

1 Answers1

3

Yes, even in ColdFusion 8 you can use DDX to add footers and headers to a PDF. See the specific Adobe 8 Livedocs on how to do this. I also have a couple blog posts 1 and 2 that might help. ALthough I tested on CF9, there's CF8 valid information as well. You might also want to get the almost impossible to find DDX reference. Also check out ColdFusion Jedi's 8 part series on PDF manipulation in CF8.

UPDATE (Added information below on combining text):

To take PDF1 and PDF2 and put the text on a single page in resulting PDF, the first thing that comes to mind is that you could use cfpdf with the getinfo action to get the text (if you don't already have it in a plain text or HTML format). Then you could cfoutput the text into a cfdocument element of type pdf. That way you get a new merged PDF with the contents combined.

Tony Miller
  • 9,059
  • 2
  • 27
  • 46
  • This has been a HUGE help, so far. I have this working as Ray has laid out. However, the client wants me to put the text (Doc2) on the same page as Doc1, rather than appending as page 2. Do you have any ideas on that? – Gene R Nov 01 '10 at 18:36
  • @Gene R - The CF documentation actually does have a DDX example for creating footers. http://livedocs.adobe.com/coldfusion/8/cfpdf_17.html – Leigh Nov 01 '10 at 18:52
  • Wow, again, this is a GREAT help! Gotten much farther than I thought possible. One last (hopefully) thing. Is there a way to format the actual PDF. I want to make it 8.5x14 (legal) and add this new text to that bottom 3" of space. – Gene R Nov 02 '10 at 13:42
  • @Gene R - I am not sure if that is possible with DDX since "PageSize" and "PageOverlay" are on the *excluded* tag list. If not, you could always try iText (lower level and requires createObject("java") access. – Leigh Nov 02 '10 at 15:42
  • @Leigh Ok, i've seen a little bit out there about iText, would you recommend using it for just the PageSize part, or the entire app? Sorry but this is a very new arena for me. – Gene R Nov 02 '10 at 17:45
  • @Gene R - I am not sure what else your app. is doing, but most likely just the pageSize part. iText is great stuff, but it is lower-level and a little more complex than cfpdf/ddx. You would normally use it only when CF does not provide the functionality or granularity you need. – Leigh Nov 02 '10 at 18:45
  • 1
    @Gene R - The closest thing I've encountered is the pageType attribute of the cfdocument tag: http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_d-e_05.html#3765835 As @Leigh says, although PageSize is a DDX element, Coldfusion 8 and 9 do not support it (Boo!). Maybe consult this node: http://stackoverflow.com/questions/4089757/how-do-i-resize-an-existing-pdf-with-coldfusion-itext – Tony Miller Nov 03 '10 at 20:48