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 :)

About these ads

Tags: , , , , ,

About saumya

Device, Desktop, Web designer and developer. I do a lot of experiments with everything I am capable of experimenting and then learn from them. Catch me up on twitter @saumya .

30 responses to “PDF2SWF : Auto conversion from PDF to SWF”

  1. Fasil says :

    Hi,

    Thanks for this article.
    Can you please provide more info on how you converted the swf to AVM2?

    Thanks and regards,

    Fasil.ak

  2. saumya says :

    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

  3. Milson cardona says :

    Excelente… GREAT… soo thanks… WAOWWWW…

  4. bosega says :

    Very nice! Also PDF to flip book convertor..link

  5. Jon David says :

    There is a good open source replacement for flashpaper :

    http://www.devaldi.com/?page_id=260

  6. sivakumar says :

    How to include a search option in the swf generated from pdf2swf like in Flashpaper ?

    • saumya says :

      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

  7. sivakumar says :

    Hi

    I got one more solution that supports the search option. Please Ref: http://print2flash.com/. Thanks for your response.

  8. Jeff says :

    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

  9. clydde says :

    Thank you very much,

    Muchas gracias

    Moltes gràcies !
    ;)

  10. Francky says :

    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

  11. Vincent says :

    How can I do the batch convert with swftools?

    Thank you for your help in adv.

    Vincent

  12. Francky says :

    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

  13. amir says :

    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

  14. saumya says :

    hey Amir,
    try Vuzit. Its kind of doing the thing, you are interested in.
    http://vuzit.com/products/demo_analytics

    Hope that helps.

  15. pageflipper says :

    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.

  16. laynechin says :

    FlashPaper did let me down. So, I turn to software that is more easy to handle without the tangle of flash code. http://www.pdf-to-flash-magazine.com is a good one.

  17. Bhawnesh says :

    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

  18. Bhavi says :

    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 :)

  19. Wael says :

    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 :)

  20. mina says :

    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.

  21. fiona says :

    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.

  22. Rahul says :

    saumya, thanks…..

  23. antony says :

    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

  24. Amit says :

    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

  25. pampanasatyanarayana says :

    very Good Job Saumya,
    My requirement is convert the Pdf file to SWF files using java.Is it maditory to use conversion tool or any other alternative solution pls provide your suggestions for us

  26. Chetan says :

    Hi,

    Do you know any Java Api or program which converts PDF to SWF file

  27. Shahzad says :

    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

  28. Ranjeet Kumar says :

    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..

  29. fernando says :

    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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: