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!
Archived Comments
That is cool! Good find, Ray!
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?
Answer to q1: Yes, it could be dynamic.
Answer to q2: You could dynamically generate the preso, but then it is static.
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.
This is really cool stuff Ray - we have some big plans for this tag here at work.
Cheers,
Davo
David - can you share them?
Nice, nice, I like it. I really love the offline feature.
Ray,
Is it possible to print from the presentation. ?
Looks like no. That would be a good enhancement request.
It would be more functional if you could link off of it.
Can you add form fields and submit data within a presentation?
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.
"it's basically CFContent who's output is Flash"
oops, I mean cfdocument who's output is flash/flashpaper
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
Ray, is there anyway to display PDF files within cfpresentation? Thanks in advance.
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.
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
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
Are you asking if you can replace them manually? Or rerun the code? If you rerun it, it should regenerate the files.
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.
Err, I'm confused. If overwrite="true" works, then just use that. Right?
can rtmp be used with cfpresentationslide?
example: audio="rtmp://x.x.x.x/Music/Track-01.mp3"
Don't think so.
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
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?
Also, what happens if you try a full directory? Or is that you meant?
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.
Can you show the cfpresentatiosnlide code?
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.
Ok I have changed the reference to an absolute path using expandpath and it loads. Next problem is the audio is missing. <sigh>
What if you use video="..." instead?
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.
Doh. I guess you need to use the separate AUDIO attribute and use an Mp3.
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.
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.
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?
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?
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?