Sunday, March 14, 2010

Installing swftools on FreeBSD using port tools

Doing a pkg_which swftools show nothing, and swftools needs to be installed. So what I did,
I changed directory by

cd /usr/ports/graphics/swftools/

then issued command

 make install clean

and encountered this error

===>   jpeg-8_1 depends on package: libtool>=2.2 - not found
===>   Found libtool-1.5.26, but you need to upgrade to libtool>=2.2.

so I issued portupgrade command to upgrade my libtool by

 portupgrade -r libtool


cd /usr/ports/graphics/swftools/

yet, another error I encountered.

===>   An older version of graphics/jpeg is already installed (jpeg-6b_7)
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of graphics/jpeg
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1

Then jpeg needs to be upgraded, I did uninstall the jpeg tool located in "graphics/jpeg" under ports directory thru command:
cd ../jpeg
make deinstall
make reinstall

then I go back to 

cd /usr/ports/graphics/swftools/

and install thru command

make install clean

After installation is finished, try issuing the command pdf2swf to test if it's properly installed and here's what I got:
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.

so it's installed now. After I see it's already installed, I issued the command 

pkg_add -r swftools

However, I got an error

Error: FTP Unable to get File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch '' by URL
root@mullimps21:/usr/ports/graphics/swftools > pkg_add -r swftools-0.9.0_2
Error: FTP Unable to get File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch '' by URL

but that's ok. pkg_add command installs the package to put under pakage list

So that's all I did. Hope this helps ;-)