Configuring SWFTools

By default the application comes with a Tomcat bundle with pre-configured SWFTools.

In most cases it is not necessary to install SWFTools on your server. Only if it presents some problem with the pre-configured SWFTools in the Tomcat bundle.

 

The application takes advantage of SWFTools to convert PDF documents to SWF to be shown in the 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

The Pdf2swf tool is used to convert PDF documents to SWF.

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

The parameters specify that:

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

Red Hat and CentOS

It is better to 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

The Pdf2swf tool is used to convert PDF documents to SWF.

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

The parameters specify that:

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

Take a look at pdf2swf wiki for the complete parameters reference.

Debian

This package is not included in the Debian repositories, so you need to compile it 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 installing the Ubuntu package.

Take a look at pdf2swf wiki for the complete parameters reference.

Improving performance

For better performance, use this configuration.

PropertyDescription

system.swftools.pdf2swf

The Pdf2swf tool is used to convert PDF documents to SWF.

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

The parameters specify that:

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

Windows

Download the latest SWFTools http://www.swftools.org/download.html and install it (for example at c:\tomcat-8.5.69\tools\swftools).

Improving performance

For better performance, use this configuration.

PropertyDescription

system.swftools.pdf2swf

The Pdf2swf tool is used to convert PDF documents to SWF.

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

The parameters specify that:

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

Take a look at pdf2swf wiki for the 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 work around this error by adding the -s poly2bitmap parameter, which converts 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 dumped)

This is a log of a segmentation fault error:

/home/openkm/tomcat-8.5.69/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, the bitmap option is more reliable for fixing display issues, but of course it may decimate text and, in some cases, increase file size and processing time. You can also add the -s multiply=4 bitmap argument to get a really crisp bitmap output, further increasing size and processing time, but getting you pretty close to the original PDF.

/home/openkm/tomcat-8.5.69/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 copy-protected PDF

Perhaps the PDF is copy-protected. Therefore, 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 in the Tomcat bundle comes with this hack.