PDF import plugin

Posted by
|

Description

This plugin is used to import pdf files into a template publication.

Download

Source files are available here : PDF import plugin for Silex – sources

Installation

To use this plugin, you need first to install SWFTools on the server.

SWFTools Install

On Windows, download windows version (binary) on SWFTools official website: http://www.swftools.org/

Or you can download SWFTools for Windows from Silex Labs server here  swftools-0.9.1-windows

Then install it to C:SWFTools.

!!! Make sure to not install it to the default path C:Program FilesSWFTools !!!

On Mac OSX, XCode should be installed first. It is normally already installed on most Macs.

Then a compiler such as macports needs to be installed.

Downlad and launch the DMG disk image from http://www.macports.org/ .

Then download linux version from SWFTools official website: http://www.swftools.org/

Or you can download SWFTools for Mac os from Silex Labs server here swftools-0.9.1.tar

Then install it, by opening Terminal (it is under Applications > Tools) and running following command:

sudo port install swftools

Note : you must running at minima a 10.6 Mac OS version

On Linux, download the Linux version of SWFTools (swftools-0.x.x.tar.gz) from SWFTools official website: http://www.swftools.org/

Then compile the source files:

Type on the command-line:

tar -xzf swftools-0.x.x.tar.gz

cd swftools-0.x.x

./configure

make

make install

Plugin Install:

On Windows, MacOSX and Linux just copy the pdfImport folder into your silex’s server’s plugin directory.

Template install:

Publication templates specific to pdfImport plugin have to be added in the server before importing a pdf.

They can be found here: http://exchange.silexlabs.org

They have to be placed in servercontents_themes folder.

Access

There are two possible ways to access this plugin:

  • access via standalone mode:

server/plugins/pdfImport/standalone.php

You do not need to be connected to use this mode.

  • access via the manager

You need to be connected to use this mode

Settings

Plugin activation:

Go to your server’s manager click on Settings > Plugins > Activate a plugin, choose PDFImport plugin and click on “confirm”.

Path to SWFTools parameter setting

(only if accessed via manager. If accessed via standalone mode, to be done by sever admin):

Value:

The “Path to SWFTools” parameter needs also to be filled with the path where SWFTools has been installed.

Using the method provided above, the path should be C:SWFTools on Windows, and /opt/local/bin/ on MacOSX.

On MacOSX and Linux, the path can be found by opening a terminal and entering the following command: “which pdf2swf” or “whereis pdf2swf”.

The correct path is given by removing the “pdf2swf” string to the output.

UI setting:

Then to access the plugin, go to Settings > Plugins > pdfImport.

Manual setting:

It is also possible to set it in silex_server/contents_utilities/manager/conf.txt and adding the following line:

pathToSWFTools = ‘/opt/local/bin';

Linux server safe mode specific settings:

When the server is in safe mode, following issues can happen:

Owner issue:

When safe mode is activated on the server, make sure that both silex server and plugins files and directories have the same owner than the one executing the scripts. To do so, you can use following command on your silex server or plugin root and replace “user” and “group” by the correct values:

“chown -R user:group .”

SwfTools execution issue:

If safe mode is activated, possible execution durectories are stored in php.ini safe_mode_exec_dir directive.

Update its value accordingly :

safe_mode_exec_dir = “/usr/local/bin”

The most secure way to do would be to copy all swftools scripts from “/usr/local/bin” to “/usr/local/bin/swftools” and then update php.ini

safe_mode_exec_dir = “/usr/local/bin/swftools”

In that case, do not for get to update manager’s plugin’s pathToSWFTools parameter accordingly:

pathToSWFTools = ‘/opt/local/bin/swftools';

Generic issues:

To resolve installation or execution problem, try using chmod on you plugin dir:

chmod 755 (or chmod 777 for testing thus it is not recommended for production environement))

Use

Fill the form with needed parameters:

Publication name: the name of the publication to be created.

Select a PDF: the pdf file to be imported in the publication. If it is not already on the server, upload it by a using the next form.

Upload a PDF: form to upload a pdf to the server, either via ftp (access via manager) or php upload (standalone mode).

Select a template: theme to be used to generate publication.

Advanced settings: avanced pdf import plugin parameters

Once the publication has been generated with the pdf data, click the link to access the publication.

Advanced parameters
  • Use as: Allows you to choose wether the pages will be extracted in the SWF or in the JPG format.
  • Whole document /specified range: If you select “Whole Document”, the whole PDF file will get imported. If you select “Specified Range”, you will be given the possibility to choose a range of pages to import.
  • First/Last page to extract: Use when selecting “specified range” to specify the range of pages to be imported.
  • Has double pages : Should we take two pages from the PDF file to put the first one on the left of the SILEX page and the second one on the right of the SILEX page.
  • SWF files’ name prefix: The name of the pictures representing pages. The number of the page will get appended to it.
  • SWF directory: The folder in which the generated pictures should be placed (e.g: media/myPublication)
  • Layer’s name: The name of the layers generated. The number of the left page is appended to it.
  • First Silex page to include into: The number of the Silex page in which to include the first page extracted from PDF

Important Note

Everything that is in a vectorial form in the PDF file is going to get transformed into a bitmap. As a result of this, if texts are vectorized in the PDF, they are going to be transformed into a bitmap resulting in a bad quality rendering, particularly when zooming on elements.
Also, bitmaps are compressed and, as such, some artefacts can appear on them. Those artefacts are going to be particularly visible when zooming.
Users are advised to let texts as texts instead of converting them to vectors.

Comments

  1. lexa

    December 23, 2010

    What is this plugin for?
    What is SWFTools?

    sudo port install swftools
    > if you have no password, simply use “port install swftools”, no sudo??

    Settings > Plugins > pdfImport.
    > it is accessible on the manager home page

  2. lexa

    December 23, 2010

    How to make a new template for pdf import

  3. lexa

    December 23, 2010

    Could you provide an example of template in the plugin

  4. lexa

    April 9, 2011

    I have installed this plugin locally, with windows 7, 64bits.

    And it works only if SWFTools is installed in C:SWFTools

    Not if it is in C:Program Files (x86)SWFTools

  5. lexa

    May 4, 2011

    Screencast “Edit an imported PDF, Add interactions and multimedia”

    5 minutes

    This video is really something!

    http://t.co/2kKDJvs

  6. Avatar of lexa

    lexa

    November 12, 2011

    in ubuntu, I had to install these libs in order to build swftools

    apt-get install libgif-dev xpdf libfreetype6 libfreetype6-dev libjpeg62 libjpeg8 libjpeg8-dev
    apt-get install zlib1g-dev
    apt-get install gcc g++

  7. Avatar of lexa

    lexa

    November 12, 2011

    and it installed swf tools in /usr/local/bin/ (which i put in the pdf import parameters in the manager)

  8. Avatar of lexa

    lexa

    November 13, 2011

    finally on ubuntu 11 and amazon AW

    sudo apt-get install libgif-dev xpdf libfreetype6 libfreetype6-dev libjpeg62 libjpeg8 libjpeg8-dev zlib1g-dev
    sudo apt-get install gcc g++
    sudo apt-get install make

    sudo wget http://www.swftools.org/swftools-0.9.1.tar.gz
    sudo tar -xvzf swftools-0.9.1.tar.gz
    sudo ./configure
    sudo make
    sudo make install

    param of the pdf import plugin (in silex manager): pathToSWFTools=/usr/local/bin/

  9. Avatar of lexa

    lexa

    February 5, 2012

    the pdfImport plugin does not work with the “portable” version of Silex under windows (because the php of microapache does not support GD2 library)

  1. My Media – PDF import template « Silex Labs Exchange04-06-11
  2. Catalog pages list, Flip Book summary « Silex Labs Exchange07-02-11

Upcoming Events

  1. Haxepéro #18 : Apéropen source

    October 23 @ 7:00 pm - 11:00 pm
  2. Atelier Vim #4 : Vim fait sa rentrée !

    October 27 @ 7:00 pm - 9:00 pm
  3. Haxetelier #8 : Trucs et Haxetuces

    October 29 @ 7:00 pm - 9:00 pm

Sign up for Silex Labs news by email

SilexLabs community Tweets