Cool feature in CFPRESENTATION

CFPRESENTATION is one of those tags that are pretty good - but I'm not sure how often I'll use it. While working on WACK though I discovered that the tag has a feature that is pretty darn interesting. As you may (or may not know), the CFPRESENTATION tag creates Connect presentations on the fly. This could be useful for multiple purposes. You could use it to create dynamic portfolios for a company. You could use it for tutorials. Etc. This example creates a basic 2 slide static example:

<cfpresentation title="First Presentation" autoPlay="false">

<cfpresentationslide title="Welcome to CFPRESENTATION" notes="These are some notes."> <h1>Welcome to CFPRESENTATION</h1>

<p> This is content for the first slide. I can include HTML and it will be rendered by the presentation. </p> </cfpresentationslide>

<cfpresentationslide title="Sales Figures" notes="These are some notes for slide two."> <h1>Sales Figures</h1>

<p> Some fake data. </p>

<p> <table width="100%" border="1"> <tr> <th>Product</th> <th>Price</th> </tr> <tr> <td>Apples</td><td>$0.99</td> </tr> <tr> <td>Bananas</td><td>$1.99</td> </tr> <tr> <td>Nukes</td><td>$2.99</td> </tr> </table> </p> </cfpresentationslide> </cfpresentation>

You can see this output here.

What I discovered (and the reason for the post is), you can also use CFPRESENTATION to create offline presentations as well. If you supply the directory attribute, the generated Connect presentation will be stored to the file system. This code will have no need for ColdFusion and could be zipped up (using CFZIP) and mailed to someone. The end user could then unzip the files onto their desktop and open the presentation there. Here is a short snippet showing this in action:

<cfset directory = expandPath("./stored")> <cfif not directoryExists(directory)> <cfdirectory action="create" directory="#directory#"> </cfif>

<cfpresentation title="First Presentation" autoPlay="false" directory="./stored"> More slides here...

I've included a simple presentation at the end of this blog post. Just use the download link. For more about CFPRESENTATION, be sure to pick up the WACK!

Download attached file.

Archived Comments

Comment 1 by Brian Swartzfager posted on 8/29/2007 at 3:33 PM

That is cool! Good find, Ray!

Comment 2 by Jim Priest posted on 8/29/2007 at 4:37 PM

So I'm assuming in your first example - the 'fake data' could be actual data pulled from a db? Will that work with the 'offline' presentation as well - ie - pull down the current data - then save it as a file?

Comment 3 by Raymond Camden posted on 8/29/2007 at 5:20 PM

Answer to q1: Yes, it could be dynamic.

Answer to q2: You could dynamically generate the preso, but then it is static.

Comment 4 by someone posted on 8/29/2007 at 5:50 PM

here's another tip.

seen Adobe Connect Presenter? the little tool that takes a powerpoint, adds the presenters details and audio track and converts it to a swf as content for your breeze presso?

where have you seen one of them I wonder?

the only thing I've yet to try is saving the PPT to HTML first and then SWF'ing it with the cfpresentation tag.

Comment 5 by David posted on 8/29/2007 at 6:21 PM

This is really cool stuff Ray - we have some big plans for this tag here at work.

Cheers,

Davo

Comment 6 by Raymond Camden posted on 8/29/2007 at 6:25 PM

David - can you share them?

Comment 7 by William from Lagos posted on 8/29/2007 at 6:46 PM

Nice, nice, I like it. I really love the offline feature.

Comment 8 by Yves posted on 8/29/2007 at 7:19 PM

Ray,

Is it possible to print from the presentation. ?

Comment 9 by Raymond Camden posted on 8/29/2007 at 7:24 PM

Looks like no. That would be a good enhancement request.

Comment 10 by Gene Godsey posted on 11/26/2007 at 9:29 PM

It would be more functional if you could link off of it.

Comment 11 by Jeff posted on 2/14/2008 at 7:21 PM

Can you add form fields and submit data within a presentation?

Comment 12 by barry.b posted on 2/14/2008 at 7:33 PM

I don't think it's possible, using HTML

while cfpresentation can use HTML to create content, the final result is a SWF. it's basically CFContent who's output is Flash.

having said that, using a swf as content gives you most of the functionality of Flash. we use it for having a m/c quiz at the end of a presso, so at a guess, a form and posting values to a url might be possible. the target url might have to be hard-coded however...

I can see where you're going with the idea, and it would be great if it could, but I'm not sure it's possible or practical.

Comment 13 by barry.b posted on 2/14/2008 at 7:35 PM

"it's basically CFContent who's output is Flash"

oops, I mean cfdocument who's output is flash/flashpaper

Comment 14 by Jeff posted on 2/14/2008 at 7:42 PM

Thank you for the reply.. I kinda figured that it would be hard to do, but then some of you guys are just amazing in what you figure out, so it was worth it to ask.

Thanks

Comment 15 by Sean posted on 2/21/2008 at 7:57 AM

Ray, is there anyway to display PDF files within cfpresentation? Thanks in advance.

Comment 16 by Raymond Camden posted on 2/21/2008 at 5:15 PM

AFAIK, no. You could use my pdfUtils component to read the text from a PDF and put that in, but you will lose the formatting.

Comment 17 by John Barrett posted on 2/3/2009 at 11:26 AM

Hi Ray, you are a hero!
I just asked this question on CF Talk, and searching Google let me find this post, thank so much!

One question however, is it possible to replace the current files in the stored directory that you write to? That if you should modify the file?

I am just using
<cfpresentation title="my title" directory="./stored">

Thanks so much,
John

Comment 18 by John Barrett posted on 2/3/2009 at 12:27 PM

HI Ray,
Well I got it`-`
<cfpresentation title="my Title" autoPlay="false" directory="./stored" overwrite="yes">

I just wanted to post this here incase somebody else finds this and was wondering the same thing.

Thanks so much:)
John

Comment 19 by Raymond Camden posted on 2/3/2009 at 5:08 PM

Are you asking if you can replace them manually? Or rerun the code? If you rerun it, it should regenerate the files.

Comment 20 by John Barrett posted on 2/4/2009 at 11:56 AM

Hi Ray,

Without the overwrite=yes, CF threw an error "unable to create file" So I ask asking how to replace the current files this way, but with CF, and not manually replace the files.

By the way, this was for a class presentation, and it was a big hit, the instructor really loved the output, and when I showed him how it was made, even more impressive, CF Rocks:)

Maybe this will motivate the University to get a coldFusion Server.

Comment 21 by Raymond Camden posted on 2/4/2009 at 5:05 PM

Err, I'm confused. If overwrite="true" works, then just use that. Right?

Comment 22 by Mike posted on 4/9/2009 at 6:23 AM

can rtmp be used with cfpresentationslide?
example: audio="rtmp://x.x.x.x/Music/Track-01.mp3"

Comment 23 by Raymond Camden posted on 4/9/2009 at 6:34 AM

Don't think so.

Comment 24 by Gerd posted on 7/24/2009 at 12:17 AM

Hi Ray,
I was wondering if you could help on this one. I keep getting the following error message when I try to run a cfpresnetation.

java.io.FileNotFoundException: C:\ColdFusion8\lib\preso\blank.swf (The system cannot find the file specified)
I get this message even if I specifiy a directory. All the files do get created in the directory I specify,
yet i still get this same error message. I've also used your exact code from this post and I get the same thing.

I've googled on this and can't find anything. Thought you might be able to help.

Thanks

Comment 25 by Raymond Camden posted on 7/25/2009 at 12:34 AM

So to be clear, you use the tag to generate a preso and when you run it, it is tryingto point to cf8's install folder?

Comment 26 by Raymond Camden posted on 7/25/2009 at 12:35 AM

Also, what happens if you try a full directory? Or is that you meant?

Comment 27 by Don posted on 9/7/2009 at 6:01 PM

When I add a swf to cfpresentationslide I get an error that CF cannot read the file. I can take the url and paste in the browser and it works fine? Any ideas? I have temporarily changed permissions so that all can rwx but that doesn't help.

Comment 28 by Raymond Camden posted on 9/7/2009 at 6:04 PM

Can you show the cfpresentatiosnlide code?

Comment 29 by Don posted on 9/7/2009 at 6:18 PM

Error message: Unable to read src file /images/tutorial/intro.swf.
Code: <cfpresentationslide src="#assets#intro.swf" />
assets obviously evaluates to: /images/tutorial/
If I put an absolute file path it works.

Comment 30 by Don posted on 9/7/2009 at 6:28 PM

Ok I have changed the reference to an absolute path using expandpath and it loads. Next problem is the audio is missing. <sigh>

Comment 31 by Raymond Camden posted on 9/7/2009 at 6:33 PM

What if you use video="..." instead?

Comment 32 by Don posted on 9/7/2009 at 6:44 PM

Video is apparently only for the "presenter" not the slide. If I change to video it whines that there is no body content in the slide.

Comment 33 by Raymond Camden posted on 9/7/2009 at 6:45 PM

Doh. I guess you need to use the separate AUDIO attribute and use an Mp3.

Comment 34 by Don posted on 9/7/2009 at 7:23 PM

thanks that works. Kind of a kludge. Record a swf then play it back and record audio, convert to mp3. I guess the advantage is I don't have to rerecord the swf if I flub the audio.

Comment 35 by Joe posted on 11/7/2009 at 4:19 AM

I also had the java.io.FileNotFoundException: C:\ColdFusion8\lib\preso\blank.swf issue (CF 8 Standard Edition). I simply created blank.swf in that folder from the Master800000000.swf and then it worked.

Comment 36 by Corey posted on 1/8/2010 at 6:49 AM

I haven't had a lot of uses for this tag, but have recently worked with it. I needed to add some swf files to a presentation... some short clips of people talking. The presentation worked, but every slide with an swf source starts and then restarts after a second. Actually, it was kind of like a stutter and my first thought was a buffering issue.

Has anyone else experienced this?

Comment 37 by Carter posted on 3/31/2014 at 12:44 AM

First time using this tag - love it! Question though - for a simple image slideshow, CF wants to download all the images before it starts to display. Even on 4G, that will burn through the patience of my ultra-relaxed audience. I assume this is because CF is rendering the individual slides into one flash file. Am I missing something elementary?

Comment 38 by Raymond Camden posted on 3/31/2014 at 5:21 AM

Wow, I forgot about this blog post.

I'd honestly recommend *against* using cfpresentation for an image slide show. There are about a million different JS libraries out there that would give you an image slide show, I'd use one of them instead. Is that an option?