PDF2SWF : Auto conversion from PDF to SWF

I never thought I will be converting some PDF files into SWF anytime. But the time has come and I was doing the same for past some days. Well,while deciding for the tools and technology I always thought FlashPaper is a good option. Surprisingly for me FlashPaper is dead now ! In the beginning days I always asked myself why FlashPaper was created from Macromedia ?! But then situations come up,where one has to fall back to flash technology. Well, with the death of FlashPaper, I lost hope, then found Scribd. Awesome, they do the same thing online and have a rich set of API exposed for developers to do the same. Unfortunately, for security reasons my option only include softwares which can be used in-house.

Well, then I came across SWFTOOLS. An opensource library of tools for SWF. One of the tools is PDF2SWF. As the name suggests, it converts a complete PDF to SWF. It not only just converts PDF to SWF but also maintains all the links in the PDF in the generated SWF. Thats a pretty nice job. It has a GUI too for those who want to use it. Personally I found the command line of this tool to be awesome. There are a large number of options available while converting from PDF to SWF. By default once the SWF is created it starts running as a presentation in a default timer. There is an option to put “stop()”  action in each frame(as each page becomes one frame),nice and sweat. The default conversion gives a nice default viewer to navigate to different pages,zoom in/out and scrollbars. One can customise the default viewer to make ones one viewer too.

The only thing which hurt me is the SWF produced in a AVM1 Movie,though SWFTOOLS says that the latest version produces AVM2 movies,but it is not. To make an AVM2 movie I just passed in the flashplayer version 10.0 in one of the command line options.That gave me an AVM2 movie. For my custom player, I just went ahead and loaded the movie with an “Loader” and since its AVM2,I typecast it to a “MovieClip” and then started controlling it through AS3.

I am expecting more from the tool and the first expectations is, it should produce an AVM2 movie. The method to add a viewer should be more easier.

Over all, the tools are just freaking cool. All the best to the SWFTOOLS. Hoping to see this project mature.

Lastly below are the options one will get while firing up PDF2SWF from command line. I have just copied the help from PDF2SWF from my command line to put it here.

Usage: pdf2swf [-options] file.pdf -o file.swf

-h , –help                    Print short help message and exit
-V , –version                 Print version info and exit
-o , –output file.swf         Direct output to file.swf. If file.swf contains ‘%’ (file%.swf), then each page goes to a seperate file.
-p , –pages range             Convert only pages in range with range e.g. 1-20 or 1,4,6,9-11 or
-P , –password password       Use password for deciphering the pdf.
-v , –verbose                 Be verbose. Use more than one -v for greater effect.
-z , –zlib                    Use Flash 6 (MX) zlib compression.
-i , –ignore                  Allows pdf2swf to change the draw order of the pdf. This may make the generated
-j , –jpegquality quality     Set quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)
-s , –set param=value         Set a SWF encoder specific parameter.  See pdf2swf -s help for more information.
-w , –samewindow              When converting pdf hyperlinks, don’t make the links open a new window.
-t , –stop                    Insert a stop() command in each page.
-T , –flashversion num        Set Flash Version in the SWF header to num.
-F , –fontdir directory       Add directory to the font search path.
-b , –defaultviewer           Link a standard viewer to the swf file.
-l , –defaultloader           Link a standard preloader to the swf file which will be displayed while the main swf is loading.
-B , –viewer filename         Link viewer filename to the swf file.
-L , –preloader filename      Link preloader filename to the swf file.
-q , –quiet                   Suppress normal messages.  Use -qq to suppress warnings, also.
-S , –shapes                  Don’t use SWF Fonts, but store everything as shape.
-f , –fonts                   Store full fonts in SWF. (Don’t reduce to used characters).
-G , –flatten                 Remove as many clip layers from file as possible.
-I , –info                    Don’t do actual conversion, just display a list of all pages in the PDF.
-Q , –maxtime n               Abort conversion after n seconds. Only available on Unix.

Happy Flashing :)

31 thoughts on “PDF2SWF : Auto conversion from PDF to SWF

  1. hi Fasil,
    good to know it helped.
    Well,chaging to AVM2 is completely, not possible now.I just overwrite the default flash version to 10.0 with the “-T” arguement.
    -T , –flashversion num Set Flash Version in the SWF header to num.

    hope that helps

    1. Hi sivakumar,I am sorry for the late. First of all this is my first comment on the new year. Happy new year to you.
      well, the “search”,you have to incorporate some kind of logic to do that,its not by default from PDF2SWF.
      There is another interesting open source component (like flashpaper) came up called FlexPaper,which wraps your pdf2swf converted SWFs. Though I have not tried it myself,but it looks promising.(http://code.google.com/p/flexpaper/)
      hope that helps
      Happy Flashing :) the new year

  2. Got a question about tbe PDF2SWF that no seems to have run into before. I am attempting to convert some PDFs but all I get in the output is a whole lot of ‘Error: Couldn’t create temporary font file’ The folder has no restrictions for read/write access – I am at a total loss!!! Can you provide ome insight?

    Thanks

  3. I’m interessed in publishing pdf on web sites.

    Flexpaper a nice tool. I’ve found an other proposition too (still under development but working) :

    Freeepaper

  4. Hi Vincent,

    You can try pdf2swf document.pdf -o document.swf -s -T 9

    or if your OS is windows, you can use the pdf2swf GUI.

    Francky

  5. can you tell me i want a script for my website pdf to swf viewer without any software online

    like google viewer

    i want the html or java script code for this work

  6. Transforming your PDF materials into flash flip book becomes easier with page flipper online service. No need for additional software and conversion is so simplified that even people who don’t use Internet often can use it effectively.

  7. Hi Saumya can u mail me u r contact details i wanna discus with u reg PDF to swf & same for doc to swf ppt to swf excel to swf i know it’s possible but how no idea

  8. Hey Saumya thanks a lot for such useful details but i m making AIR application in Flex and want to convert PDF to SWF through ASP.Net webservice. well can u tell me how to code this PDF2SWF command line integration.. for converting SWF in flip book i have referred This Code..
    Plss do help….
    Thanks in advance…
    Take Care :)

  9. Thanks for the all these details. It works very well! But i have a problem that i can’t resolve it yet. When the swf files are genereted, i’ve an error message : Unknown font id.
    I tried to use -F Fonts-folder, and i put there the missed fonts, but it does’nt work!

    Can you tell me if it’s possible to add a subtitute font, for all missed ones?

    Thanks :)

  10. PDF2SWF will be a reverse choice for me, thank you for the findings. As i’ve had a good PDF to flash converter , but i am looking for a pdf to flash page flip program. can you suggest one? Then give my pdf file a digital edtion. thanks in advance.

  11. Very nice! SWFTOOL really a powerful site to take care all aspects of swf flash conversion.
    I have got a PDF to flash converter , compared to that it’s more like a oriented tool. Just several clicks then I can, view files with flash player.
    Although I don’t know more about command line, but I want to learn it from here.

  12. i have a “go daddy” shared hosting for php, mysql. Is there any possibilities for converting pdf to swf without installing anything in linux environment. Because i have no dedicated server.

    Thanks
    J.Antony Jeyaprakash

  13. Hey Saumya

    i m getting an error sayin pdf2swf command not found…does that mean i havent installed the swftools correctly??
    but during installation i did not got any error. I am using it on Ubuntu.

    Please reply what could be the issue

    Thanx

  14. Hi,

    -p , –pages range Convert only pages in range with range e.g. 1-20

    What if i have to convert a larger file say pages in range with range e.g. 20-40

  15. i am facing a problem when converting a pdf into swf using swftools .Is there is any solution of this problem

    ERROR ID Table overflow
    ERROR This file is too complex to render- SWF only supports 65536 shapes at once

    Thanks..

  16. Hello!
    I need a viewer like rfxviewer that support “go to page XXX”

    Please, do you know about it?

    Thanks in advance,
    Fernando Jabonero

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.