Difference between revisions of "Third-party software integration: SWFTools"

From OpenKM Documentation
Jump to: navigation, search
(Linux)
(Segmentation fault (core dumped))
 
(20 intermediate revisions by 2 users not shown)
Line 4: Line 4:
  
 
{{Warning|Starting from OpenKM 5.1 this configuration property has changed to '''system.swftools.pdf2swf'''.}}
 
{{Warning|Starting from OpenKM 5.1 this configuration property has changed to '''system.swftools.pdf2swf'''.}}
 +
 +
{{Note|Since OpenKM 5.1.9 the pdf2swf command line parameters should be added in the configuration property, for example:
 +
  <nowiki>system.swftools.pdf2swf=/usr/bin/pdf2swf -T 9 -f ${fileIn} -o ${fileOut}</nowiki>
 +
}}
 +
 +
See [http://flexpaper.devaldi.com/docs_converting.jsp FlexPaper: Converting Documents] for more info.
  
 
== Linux ==
 
== Linux ==
 +
=== Ubuntu===
 
Swftools can be installed running in terminal:
 
Swftools can be installed running in terminal:
  
 
  $ sudo aptitude install swftools
 
  $ sudo aptitude install swftools
  
Enable in [[OpenKM.cfg]]:  
+
Enable in [[OpenKM.cfg]] or Administration > Configuration depending on your OpenKM version:
  
  system.pdf2swf=/usr/bin/pdf2swf
+
  system.swftools.pdf2swf=/usr/bin/pdf2swf
  
 
{{Note|In Ubuntu 10.04 is possible you need to add this line to '''/etc/apt/sources.list'''
 
{{Note|In Ubuntu 10.04 is possible you need to add this line to '''/etc/apt/sources.list'''
Line 18: Line 25:
 
}}
 
}}
  
{{Note|In Ubuntu 10.10 this package is not included, so you need to compile it or grab from https://launchpad.net/~ella-animation/+archive/dev.}}
+
{{Note|In Ubuntu 10.10 this package is not included, so you need to compile it or grab from https://launchpad.net/~ella-animation/+archive/dev:
 +
  $ sudo add-apt-repository ppa:ella-animation/dev
 +
  $ sudo aptitude update
 +
  $ sudo aptitude install swftools
 +
}}
  
 
=== Red hat ===
 
=== Red hat ===
Line 41: Line 52:
 
  $ make
 
  $ make
 
  $ make install  
 
  $ make install  
 +
 +
Or you can try to install the Ubuntu package. For Debian Squeeze I recommend the Ubuntu Lucid package.
  
 
=== Improving performance ===
 
=== Improving performance ===
For better performance, use this configuration. Create file pdf2swf_wrapper.sh
+
For better performance, use this configuration.
  
<source lang="bash">
+
  system.swftools.pdf2swf=/usr/bin/pdf2swf -T 9 -f -t -G -s storeallcharacters ${fileIn} -o ${fileOut}
#!/bin/bash
 
  
/usr/bin/pdf2swf $* -f -t -G -s storeallcharacters
+
The parameters specifies that:
</source>
 
 
 
The last 5 parameters specifies that:
 
  
 
* -f : Fonts should be embedded, improves searchability in the document
 
* -f : Fonts should be embedded, improves searchability in the document
Line 57: Line 66:
 
* -G : Makes the document smaller and faster to render
 
* -G : Makes the document smaller and faster to render
 
* -s storeallcharacters : Stores all character information about the texts in the document, improves searchability  
 
* -s storeallcharacters : Stores all character information about the texts in the document, improves searchability  
 +
 +
==== OpenKM 5.0.x ====
 +
Create file pdf2swf_wrapper.sh
 +
 +
<source lang="bash">
 +
#!/bin/bash
 +
 +
/usr/bin/pdf2swf $* -f -t -G -s storeallcharacters
 +
</source>
  
 
Make it executable:
 
Make it executable:
Line 69: Line 87:
  
 
{{Note|Take a look at [http://wiki.swftools.org/index.php/Pdf2swf pdf2swf wiki] for complete parameters reference, and remember that JBoss must be restarted after every [[OpenKM.cfg]] modification.}}
 
{{Note|Take a look at [http://wiki.swftools.org/index.php/Pdf2swf pdf2swf wiki] for complete parameters reference, and remember that JBoss must be restarted after every [[OpenKM.cfg]] modification.}}
 
See also [[Troubleshooting#Some_PDF_file_not_shown_in_preview|Troubleshooting: Some PDF file not shown in preview]].
 
  
 
== Windows ==
 
== Windows ==
Line 80: Line 96:
  
 
=== Improving performance ===
 
=== Improving performance ===
For better performance in conversion, create file pdf2swf_wrapper.bat
+
For better performance in conversion,  
  
<source lang="bash">
+
  system.swftools.pdf2swf=c:/path/to/pdf2swf.exe -T 9 -f -t -G -s storeallcharacters ${fileIn} -o ${fileOut}
c:\path\to\pdf2swf %1 %2 %3 -f -t -G -s storeallcharacters
 
</source>
 
  
The last 5 parameters specifies that:
+
The parameters specifies that:
  
 
* -f : Fonts should be embedded, improves searchability in the document
 
* -f : Fonts should be embedded, improves searchability in the document
Line 92: Line 106:
 
* -G : Makes the document smaller and faster to render
 
* -G : Makes the document smaller and faster to render
 
* -s storeallcharacters : Stores all character information about the texts in the document, improves searchability  
 
* -s storeallcharacters : Stores all character information about the texts in the document, improves searchability  
 +
 +
==== OpenKM 5.0.x ====
 +
Create file pdf2swf_wrapper.bat
 +
 +
<source lang="bash">
 +
c:\path\to\pdf2swf %1 %2 %3 -f -t -G -s storeallcharacters
 +
</source>
  
 
And don't forget to change the [[OpenKM.cfg]] file:
 
And don't forget to change the [[OpenKM.cfg]] file:
Line 102: Line 123:
  
 
See also [[Troubleshooting#Some_PDF_file_not_shown_in_preview|Troubleshooting: Some PDF file not shown in preview]].
 
See also [[Troubleshooting#Some_PDF_file_not_shown_in_preview|Troubleshooting: Some PDF file not shown in preview]].
 +
 +
== Conversion problems ==
 +
Here try to show commons problems with pdf conversion and possible solutions.
 +
 +
=== Conversion problems with big files ===
 +
If the document is big (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:
 +
 +
  system.swftools.pdf2swf=/usr/bin/pdf2swf -T 9 -f -t -G -s poly2bitmap -s storeallcharacters ${fileIn} -o ${fileOut}
 +
 +
See also [[Troubleshooting#Some_PDF_file_not_shown_in_preview|Troubleshooting: Some PDF file not shown in preview]].
 +
 +
=== Segmentation fault (core dumped) ===
 +
This is a log of segmentation fault error:
 +
/home/openkm/tomcat-7.0.27/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 with you can try the '''-s poly2bitmap''' or '''-s bitmap arguments'''. For our experience 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.27/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
  
 
[[Category: Installation Guide]]
 
[[Category: Installation Guide]]
[[Category:OKM Network]]
 

Latest revision as of 11:34, 2 May 2013

To enable preview UI tab, OpenKM need to convert pdf files to swf.


Nota advertencia.png Starting from OpenKM 5.1 this configuration property has changed to system.swftools.pdf2swf.


Nota clasica.png Since OpenKM 5.1.9 the pdf2swf command line parameters should be added in the configuration property, for example:
 system.swftools.pdf2swf=/usr/bin/pdf2swf -T 9 -f ${fileIn} -o ${fileOut}

See FlexPaper: Converting Documents for more info.

Linux

Ubuntu

Swftools can be installed running in terminal:

$ sudo aptitude install swftools

Enable in OpenKM.cfg or Administration > Configuration depending on your OpenKM version:

system.swftools.pdf2swf=/usr/bin/pdf2swf

Nota clasica.png In Ubuntu 10.04 is possible you need to add this line to /etc/apt/sources.list
deb http://archive.canonical.com/ubuntu lucid partner


Nota clasica.png In Ubuntu 10.10 this package is not included, so you need to compile it or grab from https://launchpad.net/~ella-animation/+archive/dev:
 $ sudo add-apt-repository ppa:ella-animation/dev
 $ sudo aptitude update
 $ sudo aptitude install swftools

Red hat

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 

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. For Debian Squeeze I recommend the Ubuntu Lucid package.

Improving performance

For better performance, use this configuration.

 system.swftools.pdf2swf=/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

OpenKM 5.0.x

Create file pdf2swf_wrapper.sh

#!/bin/bash

/usr/bin/pdf2swf $* -f -t -G -s storeallcharacters

Make it executable:

$ chmod +x pdf2swf_wrapper.sh

And don't forget to change the OpenKM.cfg file:

system.pdf2swf=/path/to/pdf2swf_wrapper.sh

Nota clasica.png Take a look at pdf2swf wiki for complete parameters reference, and remember that JBoss must be restarted after every OpenKM.cfg modification.

Windows

Donwload last swftools http://www.swftools.org/download.html and install it.

Enable in OpenKM.cfg ( put this character to indicate path separator "/" not "\" )

system.pdf2swf=c:/program files/swftools/pdf2swf.exe

Improving performance

For better performance in conversion,

 system.swftools.pdf2swf=c:/path/to/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

OpenKM 5.0.x

Create file pdf2swf_wrapper.bat

c:\path\to\pdf2swf %1 %2 %3 -f -t -G -s storeallcharacters

And don't forget to change the OpenKM.cfg file:

system.pdf2swf=c:/path/to/pdf2swf_wrapper.bat

Nota clasica.png Take a look at pdf2swf wiki for complete parameters reference, and remember that JBoss must be restarted after every OpenKM.cfg modification.

See also Troubleshooting: Some PDF file not shown in preview.

Conversion problems

Here try to show commons problems with pdf conversion and possible solutions.

Conversion problems with big files

If the document is big (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:

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

See also Troubleshooting: Some PDF file not shown in preview.

Segmentation fault (core dumped)

This is a log of segmentation fault error:

/home/openkm/tomcat-7.0.27/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 with you can try the -s poly2bitmap or -s bitmap arguments. For our experience 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.27/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