Page 1 of 1

Converting PDF's & Images to Flash Slideshows (Ubuntu) Rate Topic: -----

#1 Vip3rousmango  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 56
  • View blog
  • Posts: 98
  • Joined: 10-February 10

Posted 13 April 2011 - 09:19 AM

Convert PDF & Images to Flash Slideshows
Ubuntu 8.04+


Introduction

Personally I think PDF files have become almost a standard on the internet for the filetype of choice as a document transfer format but their are still a lot of computer users who haven't even heard of .pdf files! I know, crazy! Usually, these are the type of people who don't like or understand how to install new softwear so getting them to install Adobe Acrobat Reader could be a bit of a problem.

In these situations, what I like to do is convert the files to a Flash animations. Not totally conventional, but does serve a purpose. Thankfully, almost every windows computer comes with Flash player pre-installed and (hopefully Firefox, Chrome, Opera, Flock..anything but) IE with plugins.

Conversion #1: PDF Files


To do this under Ubuntu, we are going to first use Synaptic to install the swftools package. You should check this out if you're unsure how to do this, or rarely use Synaptic Package Manager.

So, swftools is a nifty command-line application that handles all sorts of different manipulations to flash files. For example, when we type this into a terminal window:
$ pdf2swf -t dafile.pdf

This handy little command converts pdf files into flash .swf's; in our case outputing a dafile.swf, which can then be loaded into a browser for viewing!

***NOTE: The Totem movie player associates with .swf files by default so you need to make sure you're opening the .swf with a browser by right clicking and selecting Open With from the menu rather than just double clicking. END NOTE***

The -t command option turns off automatic scrolling though pages within the flash file. This means to turn pages, the reader must right-click the flash movie and choose forward/back. Yeah, totally annoying I know but required for the conversion.

To avoid this horrible circumstance with flash, we have to combine the .swf file with a simple pager, something provided by the swftools team to use! The command looks something like this:
$ swfcombine -o paged_dafile.swf /usr/share/swftools/swfs/simple_viewer.swf viewport=dafile.swf

Obviously, you should replace dafile.swf at the end of the command with the name of the file you created above in the first example. So, whats going on with that command? Well, the command first uses the swfcombine tool to output a new flash movie called paged_dafile.swf, using dafile.swf as a base. We have to type the location of the swftools pager as well for swfcombine, after the output file command to work properly.

This new flash file now incorporates two arrows for navigation at the top and bottom of the document to help naviagte forward/back.

Conversion #2: Images

So, conversions with .pdf not to difficult, but lets say you have a bunch of image files (.jpg, .png, .gif) and you'd like to do the same thing since you don't want to send a whole gallery of images to someone, just a single file. To do this each file ending has a specific tool to use. This means you can group similar images together (.jpg with .jpg) but you can't mix/match a gallery (combination of .jpg/.png/.gif). Also, this works best if all images are the same resolution. Doesn't have to be, but its optimial.

So for our example, we're going to use .jpg photos. To do this we would use the jpeg2swf command. If you wanted to do .png/.gif you use: png2swf / gif2swf commands respectively:
$ jpeg2swf -r 0.1 -o slideshow.swf photo1.jpg photo2.jpg photo3.jpg photo4.jpg

So, lets break this down. You can specifiy as many images as you like, I just stoped at four.

The -r command option sets the frames per second. For our case, it's the lengh of pause between photographs. Simply put, a value of 0.1 means a single photo is on the screen for 10 seconds. It's one frame per second divided by 0.1 which is 10 seconds. If you wanted 20 seconds between each photo, the value of -r would be 0.05 giving the desired effect of 20 seconds since 1/0.05=20.

the -o command outputs our file of slideshow.swf. But, we are going to encounter the same problem with the .pdf file. A very annoying way to swich between photos. In this case, the viewer either must wait the time between slides, or right-click and use forward/back. So, theirs no reason why we can't add the pager tool again to help scroll through the images. So our next example will add the pager and output a file called paged_slideshow.swf using the slideshow.swf from before as our starting file:
$ swfcombine -o paged_slideshow.swf /usr/share/swftools/swfs/simple_viewer.swf viewpoint=slideshow.swf


Now we have a paged, flash slideshow using our original jpeg images with some navigation arrows to help the user view the slideshow easier. And thats about it! Now you can convert to your heart's content.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1