Convert PDFs and images to Macromedia Flash slideshows

Although PDFs have become the de facto document transfer format across the Internet, there are still lots of computer users who haven't heard of them. Unfortunately, they are also the kind of people who don't understand how to install new software, so getting them to install Acrobat Reader is often asking too much.

In such a situation, you could try converting the file to a Flash animation. Virtually all Windows computers come with Flash pre-installed.

To do this conversion under Ubuntu, use Synaptic to install the swftools package. This is a series of command-line programs designed to manipulate or create Flash files.

When typed into a terminal window, the following will convert chap-ter.pdf into a Flash file: $ pdf2swf -t chapter.pdf

This will output chapter.swf, which can then be loaded into Firefox for viewing although note that Totem movie player associates with .swf files, so you specifically opt to open it in Firefox by right-clicking it and selecting from the Open With menu, rather than just double-clicking the file. The -t command option turns off automatic scrolling through the pages of the file. To turn pages, the reader must right-click the presentation and select Forward or Back. To avoid this inconvenience, you can combine the new Flash file with a simple pager, provided by the swftools team. The following uses the swfcombine tool to create a new Flash file called paged_file.swf, using chapter.swf as a base. The new Flash file incorporates two arrows at the top of the document to move back and forwards:

$ swfcombine -o paged_file.swf /usr/share/swftools/swfs/simple_viewer. ^ swf viewport=chapter.swf

Obviously, you should replace chapter.swf with the name of the file you created earlier.

To create a slideshow from JPEG photos, use the jpeg2swf command. The following will output slideshow.swf from the specified JPEG images follows:

Create an alias to save typing long commands M 299

$ jpeg2swf -r 0.1 -o slideshow.swf photo1.jpg photo2.jpg photo3.jpg photo4.jpg

You can specify as many images you wish, although this works best if the images are all the same resolution. The -r command option sets the frames per second, which in this case means the pause between pictures—put simply, a value of 0.1 means that one picture appears on-screen for 10 seconds (this effectively sets the frame rate at one frame per second divided by 0.1, which is 10 seconds; for a value of 20 seconds, you'd need to set 0.05—1/0.05=20 seconds).

If your images are in .gif or .png format, use gif2swf and png2swf, respectively.

There's no reason why you can't include the pager tool, as used with PDF conversion above, to let the user scroll through the images. The following will add-in the pager and output a file called paged_slideshow.swf, using the slideshow.swf file created above as a base:

$ swfcombine -o paged_slideshow.swf /usr/share/swftools/swfs/ simple_viewer.swf viewport=slideshow.swf

To simply create an HTML slideshow of images, see Tip 126, on page 171.

Was this article helpful?

0 0

Post a comment