Last Updated: 09/15/2011 11:54:00 AM

Embedding a SWF in a PDF with ColdFusion and iText

Embedding a SWF in a PDF with ColdFusion and iText

At a recent presentation that I did on "Working with PDFs made easy with ColdFusion"  for Adobe ColdFusion Developer week an attendee asked me if it was possible to embed a SWF into a page on a PDF with ColdFusion.  I had never tried, so I told him I would find out.  Turns out you can. Sort Of.

ColdFusion itself can not embed it directly, you can embed it as part of PDF Portfolio. PDF portfolios do not get enough attention, in my opinion. Click here to read more about them  However I think the attendee was more asking about a SWF showing in the middle of the text of a PDF. This is possible, but you must use the underlying iText java library to do so.  My code example can be found here on github:


Note: you will need to update the iText Jar on your Coldfusion server. Download the latest jar from  drop it in your ColdFusion/Lib folder and restart the ColdFusion service (this is for versions 9.01 and below that are still using the 1.2.0 version of Itext)


If you are just interested in seeing what such a PDF looks like the link is below:


Next up, embedding a Flex enabled SWF file!