Home > Uncategorized > Installing swftools and pdf2swf on Ubuntu Linux

Installing swftools and pdf2swf on Ubuntu Linux

Hello,

I’ve been using swftools, mainly pdf2swf functionality, for a while now and installation always sucked. Google usually provides good results for common problems, but lack of a step-by-step installation guide is lacking.

Main site, http://swftools.org, has pretty good wiki for documentation and a tidy installation walkthrough. Unfortunately for me I had a ton of problems getting pdf2swf to work properly on Amazon’s AWS Ubuntu server (ami-5059be39 – ubuntu-intrepid), but fortunately for you I finally got it working and also put together this guide, which will hopefully save you some time.

Note: swftools version that comes default with aptitude would not work for me hence the need to compile from source.
Note2: this guide assumes the distro is up to date and all system libraries have been installed from Installing RoR on Ubuntu post

Get necessary libraries and extract

wget http://swftools.org/swftools-0.9.0.tar.gz
tar -zvxf swftools-0.9.0.tar.gz
wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
tar -zvxf jpegsrc.v7.tar.gz
wget http://download.savannah.gnu.org/releases-noredirect/freetype/freetype-2.3.12.tar.gz
tar -zvxf freetype-2.3.12.tar.gz

Note: v8 produced errors in swftools install so I grabbed v7, which worked wonderfully.

Now order of install. First we install jpeg:

cd jpegsrc.v7
sudo ./configure
sudo make
sudo make install

Freetype is a little trickier. For install you have to reset cache, set flags, run ranlib (not sure why but it wouldn’t work without for me, if you know I’d love an explanation)

cd freetype-2.3.12
rm -f config.cache
sudo ranlib /usr/local/lib/libjpeg.a
sudo ldconfig /usr/local/lib
sudo LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include" ./configure
sudo make
sudo make install

If you want to be able to convert pdf files into text you have to install xpdf. Fortunately aptitude does provide us with the right libraries this time.

sudo apt-get install xpdf-reader

And now for the final step:

cd swftools-0.9.0
sudo LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include" ./configure
sudo make
sudo make install

Big thanks to swftools for making this possible.

Best,
Mikhail

Edit (3/3/2011): Updated code formatting.

Tags: ,
  1. October 7, 2010 at 2:12 pm

    Extremely helpful — thank you!

    -JP

  2. October 30, 2010 at 12:29 pm

    Thanls a lot for this recipe like. Works like a sunny day at the beach. 😀

  3. January 21, 2011 at 1:57 pm

    Very helpful! Thanks. This tutorial helped me installing Swftools on Mac OS, cause Macports port is failing with Segmentation Fault.

    Regards

    • January 21, 2011 at 9:21 pm

      Glad you found it helpful. I had the same problem with macports and swftools unfortunately.

  4. January 25, 2011 at 7:23 am

    My admin installed swftools-0.8.0 i faced problem with the converting pdf file with single pages. But after following this post instructions and installing swftools-0.9.1. I is working like a charm.

    Thanks
    Sathyendra V

  5. pn
    March 3, 2011 at 8:13 pm

    Thanks a ton for the instructions to build this.
    I needed this for my plone site to view PDFs.
    sudo apt-get install swftools did not work, so trid builing it with your instructions.
    PN

  6. juan
    March 10, 2011 at 5:54 pm

    MIL GRACIASSSSS ESTA SUPER

  7. Shades Of Light
    March 25, 2011 at 8:30 pm

    Cannot install.


    making install in swfs…
    cd swfs;make install
    make[1]: Entering directory `/home/lotus/swftools-0.9.1/swftools-0.9.0/swfs’
    /bin/bash ../mkinstalldirs /usr/local/share/swftools
    mkdir /usr/local/share/swftools
    /bin/bash ../mkinstalldirs /usr/local/share/swftools/swfs
    mkdir /usr/local/share/swftools/swfs
    /usr/bin/install -c -m 644 ./simple_viewer.swf /usr/local/share/swftools/swfs/simple_viewer.swf
    /usr/bin/install: cannot stat `./simple_viewer.swf’: No such file or directory
    make[1]: *** [install] Error 1
    make[1]: Leaving directory `/home/lotus/swftools-0.9.1/swftools-0.9.0/swfs’
    make: *** [install] Error 2
    ~/swftools-0.9.0$ ls

    • March 26, 2011 at 10:35 am

      Try sudo make install

      • May 21, 2011 at 12:06 am

        How do we fix the problem im getting the exact error and here is mine:

        SWFOutputDev.cc:2706:75: warning: deprecated conversion from string constant to ‘char*’
        SWFOutputDev.cc:2707:75: warning: deprecated conversion from string constant to ‘char*’
        SWFOutputDev.cc:2707:75: warning: deprecated conversion from string constant to ‘char*’
        SWFOutputDev.cc:2708:75: warning: deprecated conversion from string constant to ‘char*’
        SWFOutputDev.cc:2708:75: warning: deprecated conversion from string constant to ‘char*’
        SWFOutputDev.cc:2709:75: warning: deprecated conversion from string constant to ‘char*’
        SWFOutputDev.cc:2709:75: warning: deprecated conversion from string constant to ‘char*’
        SWFOutputDev.cc:2710:75: warning: deprecated conversion from string constant to ‘char*’
        SWFOutputDev.cc:2710:75: warning: deprecated conversion from string constant to ‘char*’
        make[1]: *** [SWFOutputDev.o] Error 1
        make[1]: Leaving directory `/home/swftools/swftools-0.7.0/pdf2swf’
        make: *** [all] Error 2

    • Anonymous
      October 5, 2011 at 2:24 am

      I also tried this and got same error have you founded the solution if you then please tell me

    • MaskedInstaller
      November 25, 2011 at 6:32 am

      In my case (debian squeeze 64) ‘make install’ gave the error:

      /usr/bin/install -c -m 644 ./simple_viewer.swf /usr/local/share/swftools/swfs/simple_viewer.swf
      /usr/bin/install: cannot stat `./simple_viewer.swf’: No such file or directory

      After getting the error (and others) I installed libjpeg62-dev, libfreetype6-dev and g++, not sure what solved what.

      Hope it helps

    • roman
      August 15, 2016 at 5:07 am

      i have same a problem. solution is very simlpe- in first sudo make then sudo make install

  8. Gustavo
    April 26, 2011 at 3:36 pm

    doesnt work in linux 64bits =(

    • April 26, 2011 at 5:52 pm

      What’s the error you are getting?

  9. Peter
    May 4, 2011 at 5:53 pm

    zlib (required by swftools) isn’t always installed by default on Ubuntu, which results in an error during the configure step in the swftools-0.9.0 directory. The solution is to run:

    sudo apt-get install zlib1g-dev

    before running that configure command.

    • March 11, 2013 at 9:04 pm

      great answer….thanks for resolving my problem

    • June 12, 2014 at 7:52 am

      Greats! thank for share. Worked for me 🙂

  10. Peter
    May 4, 2011 at 5:56 pm

    I also ran into this issue: http://comments.gmane.org/gmane.comp.tools.swftools.general/729 (a showstopper).

    Wouldn’t it be nice if swftools was available via apt-get… *sigh*

    • May 9, 2011 at 4:37 pm

      Yea I agree, not sure why they can’t do that. I also had trouble getting swftools to run under newer versions of Ubuntu, hence intrepid.

  11. Anonymous
    May 23, 2011 at 4:30 am

    Very good job! its very useful 😛

  12. quocnam
    May 26, 2011 at 4:19 am

    Thanks alot very useful.

  13. superjed29
    August 7, 2011 at 11:28 am

    Hi, i have a problem with sudo. Whenever i type in a command with sudo, it says

    -bash: sudo: command not found

    Thanks. im on bluehost server

    • August 8, 2011 at 11:40 pm

      I think you might have a problem with your os install, or just using a different *nix version. You can try su instead of sudo. Try contacting your host tech support if that doesn’t work.

      • Nik
        November 22, 2011 at 1:44 pm

        I have the same issue with an EC2 Instance running Amazon’s linux package. Try this:

        # sudo su

        Then you will be root and you won’t have to type in sudo every time.

  14. August 19, 2011 at 1:23 am

    Hello,

    I am getting the below error while configure JPEG. Please view and advise how to resolve it.

    configure: error: in `/home/ubuntu/jpeg-7′:
    configure: error: no acceptable C compiler found in $PATH
    See `config.log’ for more details.

    Thank you,

    • Abdul
      August 19, 2011 at 1:35 am

      Please run this sudo apt-get install build-essential and go ahead the installation.

  15. Mohamed Nazar
    August 19, 2011 at 1:37 am

    Hello,

    Thanks and done it, Now I am having another problem while installing swftools below error is receiving

    Error:
    You need zlib to compile swftools

    Please advise

    • Mohamed Nazar
      August 19, 2011 at 2:34 am

      sudo apt-get install zlib1g-dev

      is solved my issue.

      Thank you

  16. September 26, 2011 at 4:10 pm

    very useful! The first example you said: cd jpegsrc.v7 – That doesn’t work for me. I dropped the “v” and said; “cd jpegsrc.7” and it worked just fine and dandy-like.

    Thanks you!

  17. Anonymous
    October 11, 2011 at 11:12 am

    It asked me for following dependencies in addition to mentioned above: gif_lib.h and ungif

    To fix this: sudo apt-get install libgif-dev

  18. Anonymous
    October 11, 2011 at 12:33 pm

    swftools 0.9.1 version fixed the compilation errors thrown in 0.9.0

  19. October 13, 2011 at 5:01 am

    a great help, thank you so much! ❤

  20. November 5, 2011 at 3:57 am

    thanks for really good guide. Used this to install swftools on debian squeeze, got some errors on missing libraries, and changed to

    wget http://swftools.org/swftools-0.9.1.tar.gz
    tar -zvxf swftools-0.9.1.tar.gz
    wget http://www.ijg.org/files/jpegsrc.v8.tar.gz
    tar -zvxf jpegsrc.v8.tar.gz
    wget http://download.savannah.gnu.org/releases-noredirect/freetype/freetype-2.3.12.tar.gz
    tar -zvxf freetype-2.3.12.tar.gz

    after that – clear sailing.

    tested with pdf2swf -V

    and got output “pdf2swf – part of swftools 0.9.1” that I understand to mean that all is well.

    Happy!

  21. Javi
    April 24, 2012 at 2:28 am

    Thanks for your help. I had some problems compiling problems with the “make” command, but they were resolved using version swftools-0.9.1.

  22. Ketan Bhalerao
    August 13, 2012 at 2:57 am

    Hello techies,
    while compiling swftools I got following error
    can anybody pleae help me out ??

    ERROR:
    You need zlib to compile swftools

    • August 13, 2012 at 1:24 pm

      Try “sudo apt-get install zlib1g-dev libssl-dev libexpat1-dev -y”

    • Anonymous
      August 29, 2017 at 12:48 am

      cd /usr/local/
      wget zlib-1.2.11.tar.gz
      tar -xzvf zlib-1.2.11.tar.gz
      cd zlib-1.2.11/
      ./configure
      make
      sudo make install

  23. Rachel
    June 21, 2013 at 3:59 am

    rm -f /usr/local/share/swftools/swfs/default_viewer.swf -o -L /usr/local/share/swftools/swfs/default_viewer.swf
    rm: NA option – o
    Try the ‘rm – help’ to get more information.
    make[1]: *** [install] Error 1
    make[1]: Leaving directory `/home/ishare1/swftools-0.9.2/swfs’
    make: *** [install] Error 2

  24. rhamdani
    November 13, 2013 at 5:29 pm

    check any running process in the bg

  25. June 11, 2014 at 4:41 pm

    Great post, Mikhail All seems to work even with today’s versions of all libraries. Happy to turn over my keystroke recording text file if anyone would find it useful.

    • June 11, 2014 at 4:44 pm

      Hey, glad you found it helpful! Tbh I’m amazed it still works after so many years.

    • Anonymous
      August 26, 2015 at 10:53 pm

      kdflint, can you show us your steps?

  26. Anonymous
    June 26, 2014 at 3:27 pm

    Thank you.

  27. Anonymous
    July 18, 2014 at 2:13 am

    I got this error

    /usr/bin/install -c -m 644 ./simple_viewer.swf /usr/local/share/swftools/swfs/simple_viewer.swf
    /usr/bin/install: cannot stat `./simple_viewer.swf’: No such file or directory
    make[1]: *** [install] Error 1
    make[1]: Leaving directory `/home//Alfresco_Learner/Software/swftools-0.9.0/swfs’
    make: *** [install] Error 2

    before config i I run this command sudo apt-get install zlib1g-dev
    still i got that error

  28. January 30, 2015 at 7:24 am

    4 years later, your post is still saving lives!! 🙂
    Thank you very much. Kudos from Senegal!

  29. Anonymous
    August 26, 2015 at 10:54 pm

    I am trying to install on EC2, I get the following errors.

    ./types.h:36:2: error: #error “no way to define 64 bit integer”
    #error “no way to define 64 bit integer”
    ^
    ./types.h:39:2: error: #error “don’t know how to define 32 bit integer”
    #error “don’t know how to define 32 bit integer”
    ^
    ./types.h:42:2: error: #error “don’t know how to define 16 bit integer”
    #error “don’t know how to define 16 bit integer”
    ^
    ./types.h:45:2: error: #error “don’t know how to define 8 bit integer”
    #error “don’t know how to define 8 bit integer”

  30. Anonymous
    January 8, 2016 at 2:16 pm

    Can sombody help me, I have this problem :/

    /bin/sh ../mkinstalldirs /usr/local/share/swftools
    /bin/sh ../mkinstalldirs /usr/local/share/swftools/swfs
    /usr/bin/install -c -m 644 ./simple_viewer.swf /usr/local/share/swftools/swfs/simple_viewer.swf
    /usr/bin/install: no se puede efectuar `stat’ sobre «./simple_viewer.swf»: No existe el archivo o el directorio
    make[1]: *** [install] Error 1
    make[1]: se sale del directorio «/home/jorge/Downloads/swftools-0.5.1/swfs»
    make: *** [install] Error 2

  31. June 4, 2016 at 12:00 pm

    Installing swftools and pdf2swf on Ubuntu Linux
    is a wonderful post concerning pdf

  1. July 7, 2014 at 7:47 pm

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