Configuring SWFTools

By default the application comes with tomcat bundle with pre-configured SWFTools into.

In most cases it is not necessary installi SWFTools in your server. Only in case it presents some problem with pre-configured SWFTools into tomcat bundle.

 

Application take advantage of SWFTools to convert PDF document to SWF to be shown into UI preview tab.

See FlexPaper: Converting Documents for more info.

Ubuntu

sudo add-apt-repository ppa:guilhem-fr/swftools
sudo apt-get update
sudo apt-get install swftools

Improving performance

For better performance, use this configuration.

PropertyDescription

system.swftools.pdf2swf

Pdf2swf tool used to convert PDF documents to SWF.

/usr/bin/pdf2swf -T 9 -f -t -G -s storeallcharacters ${fileIn} -o ${fileOut}

The parameters specifies that:

  • -f : Fonts should be embedded, improves searchability in the document
  • -t : Inserts a stop between each frame, improves stability
  • -G : Makes the document smaller and faster to render
  • -s storeallcharacters : Stores all character information about the texts in the document, improves searchability

Red Hat and Centos

Better if you compile version 0.9.x

yum install zlib-devel libjpeg-devel giflib-devel freetype-devel gcc gcc-c++
wget http://www.swftools.org/swftools-0.9.1.tar.gz
tar xzf swftools-0.9.1.tar.gz
cd swftools-0.9.1
./configure --prefix=/usr/local
make
make install

Improving performance

For better performance, use this configuration.

PropertyDescription

system.swftools.pdf2swf

Pdf2swf tool used to convert PDF documents to SWF.

/usr/bin/pdf2swf -T 9 -f -t -G -s storeallcharacters ${fileIn} -o ${fileOut}

The parameters specifies that:

  • -f : Fonts should be embedded, improves searchability in the document
  • -t : Inserts a stop between each frame, improves stability
  • -G : Makes the document smaller and faster to render
  • -s storeallcharacters : Stores all character information about the texts in the document, improves searchability

Take a look at pdf2swf wiki for complete parameters reference.

Debian

This package is not include in the Debian repositories, so you need to compile from source:

aptitude install build-essential libgif-dev xpdf libfreetype6 libfreetype6-dev libjpeg62 libjpeg8 libjpeg8-dev
wget http://www.swftools.org/swftools-0.9.1.tar.gz
tar xzf swftools-0.9.1.tar.gz
cd swftools-0.9.1
./configure --prefix=/usr/local
make
make install

Or you can try to install the Ubuntu package.

Take a look at pdf2swf wiki for complete parameters reference.

Improving performance

For better performance, use this configuration.

PropertyDescription

system.swftools.pdf2swf

Pdf2swf tool used to convert PDF documents to SWF.

/usr/bin/pdf2swf -T 9 -f -t -G -s storeallcharacters ${fileIn} -o ${fileOut}

The parameters specifies that:

  • -f : Fonts should be embedded, improves searchability in the document
  • -t : Inserts a stop between each frame, improves stability
  • -G : Makes the document smaller and faster to render
  • -s storeallcharacters : Stores all character information about the texts in the document, improves searchability

Windows

Download last Swftools http://www.swftools.org/download.html and install it ( for example at c:\tomcat-7.0.61\tools\swftools ).

Improving performance

For better performance, use this configuration.

PropertyDescription

system.swftools.pdf2swf

Pdf2swf tool used to convert PDF documents to swf.

c:\tomcat-7.0.61\tools\swftools\pdf2swf.exe -T 9 -f -t -G -s storeallcharacters ${fileIn} -o ${fileOut}

The parameters specifies that:

  • -f : Fonts should be embedded, improves searchability in the document
  • -t : Inserts a stop between each frame, improves stability
  • -G : Makes the document smaller and faster to render
  • -s storeallcharacters : Stores all character information about the texts in the document, improves searchability

Take a look at pdf2swf wiki for complete parameters reference.

Troubleshooting

Conversion problems with big files

If the document is large (has many pages) or is complex, the conversion may fail with this error:

ERROR   ID Table overflow

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

You can workaround this error adding the -s poly2bitmap parameter which convert graphics to bitmaps:

PropertyDescription

system.swftools.pdf2swf

/usr/bin/pdf2swf -T 9 -f -t -G -s poly2bitmap -s storeallcharacters ${fileIn} -o ${fileOut}

Segmentation fault ( core dumpled )

This is a log of segmentation fault error:

/home/openkm/tomcat-7.0.61/bin/pdf2swf -f -T 9 -t -s storeallcharacters input.pdf -o output.swf
NOTICE  processing PDF page 1 (878x1105:0:0) (move:0:0)
NOTICE  File contains forms
NOTICE  File contains pbm pictures
NOTICE  File contains soft masks
WARNING multiply blended transparency groups not yet supported!
NOTICE  File contains transparency groups
Segmentation fault (core dumped)

You can try the -s poly2bitmap or -s bitmap arguments. In our experience it seems the bitmap option is more reliable for fixing display issues, but of course you decimate any text, and in some cases increase file size and processing time. You can also add the -s multiply=4 the bitmap argument to get a really crisp bitmap output further increasing size and processing time, but gets you pretty close to the original PDF.

/home/openkm/tomcat-7.0.61/bin/pdf2swf -f -T 9 -t -s bitmap -s storeallcharacters input.pdf -o output.swf
NOTICE  processing PDF page 1 (878x1105:0:0) (move:0:0)
NOTICE  Writing SWF file output.swf

Error with PDF with copy protected

Perhaps the PDF is copy protected. Hence, you're not allowed to convert it.

FATAL   PDF disallows copying

If you created this PDF using Acrobat Distiller, try switching the copy protection checkbox off. If you can't disable the protection you can modify the 'pdf2swf source code to disable this check (see http://www.foolabs.com/xpdf/cracking.html).  

The pre-configured pdf2swf tool into tomcat bundle comes with this hacking.