Difference between revisions of "Third-party software integration: SWFTools"
(→Segmentation fault (core dumped)) |
|||
(50 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | To enable preview UI tab, OpenKM need to convert pdf files to swf. | + | {{TOCright}} __TOC__ |
+ | |||
+ | To enable preview UI tab, OpenKM need to convert pdf files to swf. | ||
+ | |||
+ | {{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.swftools.pdf2swf=/usr/bin/pdf2swf | ||
+ | |||
+ | {{Note|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 | ||
+ | }} | ||
− | + | {{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 === | |
+ | 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. | |
− | /usr/bin/pdf2swf | + | system.swftools.pdf2swf=/usr/bin/pdf2swf -T 9 -f -t -G -s storeallcharacters ${fileIn} -o ${fileOut} |
− | |||
− | The | + | The parameters specifies that: |
* -f : Fonts should be embedded, improves searchability in the document | * -f : Fonts should be embedded, improves searchability in the document | ||
− | |||
* -t : Inserts a stop between each frame, improves stability | * -t : Inserts a stop between each frame, improves stability | ||
* -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 32: | Line 80: | ||
$ chmod +x pdf2swf_wrapper.sh | $ chmod +x pdf2swf_wrapper.sh | ||
− | And don't forget to change the OpenKM.cfg file: | + | And don't forget to change the [[OpenKM.cfg]] file: |
<source lang="java"> | <source lang="java"> | ||
system.pdf2swf=/path/to/pdf2swf_wrapper.sh | system.pdf2swf=/path/to/pdf2swf_wrapper.sh | ||
</source> | </source> | ||
+ | |||
+ | {{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.}} | ||
== Windows == | == Windows == | ||
Donwload last swftools http://www.swftools.org/download.html and install it. | Donwload last swftools http://www.swftools.org/download.html and install it. | ||
− | Enable in OpenKM.cfg ( put this character to indicate path separator "/" not "\" ) | + | Enable in [[OpenKM.cfg]] ( put this character to indicate path separator "/" not "\" ) |
system.pdf2swf=c:/program files/swftools/pdf2swf.exe | 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} | |
− | |||
− | |||
− | c: | ||
− | |||
− | The | + | The parameters specifies that: |
* -f : Fonts should be embedded, improves searchability in the document | * -f : Fonts should be embedded, improves searchability in the document | ||
− | |||
* -t : Inserts a stop between each frame, improves stability | * -t : Inserts a stop between each frame, improves stability | ||
* -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 | ||
− | And don't forget to change the OpenKM.cfg file: | + | ==== 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: | ||
<source lang="java"> | <source lang="java"> | ||
Line 67: | Line 120: | ||
</source> | </source> | ||
− | {{Note| Take a look at | + | {{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]]. | ||
+ | |||
+ | == 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]] | ||
− |
Latest revision as of 11:34, 2 May 2013
To enable preview UI tab, OpenKM need to convert pdf files to swf.
Starting from OpenKM 5.1 this configuration property has changed to system.swftools.pdf2swf. |
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
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 |
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
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
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