Choice of image generation engine


Displaying a PDF file involves two phases: the pages of the PDF file are extracted as PNG images, then the viewer displays them.

As the generation of pages as images is an extension point, several options are available for this operation:

  • Via the java Apache PDFBox library
  • Using an external command line program, such as pdftoppm
Extraction motorExtension nameOperating systemsExtraction quality
Bookstore java Apache PDFBox

org.ametys.plugins.flipbook.convertor.Pdfbox

Allgood
External command-line program

org.ametys.plugins.flipbook.convertor.CommandLine

Linux and MacOS onlyvery good

The choice of image generation engine is made in the "" configuration file.

UsingApache PDFBox

This is the default solution because it's the easiest to implement: there's no external program to install, the library is already supplied with CMS and works with all operating systems. However, the quality of extracted images is not as good as when using an external program.

To use it, simply leave the "WEB-INF/param/runtime.xml" file empty for the extension point. "org.ametys.plugins.flipbook.Document2ImagesConvertor" (or use the org.ametys.plugins.flipbook.convertor.Pdfbox).

Using an external command-line program (pdftoppm)

The solution can work with any command-line program that extracts pages from a PDF file as numbered PNG images. This section describes how to use the pdftoppm program.

This solution has the advantage of quality: the extracted images are perfectly in line with the original PDF document. However, it requires the installation of an external program, and cannot be used in a Windows environment.

To use this solution, enter the following line in your application's"WEB-INF/param/runtime.xml " file

<org.ametys.plugins.flipbook.Document2ImagesConvertor>org.ametys.plugins.flipbook.convertor.CommandLine</org.ametys.plugins.flipbook.Document2ImagesConvertor>

This solution is preferable if the environment permits.

Program installation

You then need to install the program that makes the pdftoppm command available. The most widely used is Poppler.

To install this program under Debian/Ubuntu :

$ sudo apt-get install poppler-utils

Configuration

Using an external command line program requires a configuration parameter corresponding to the conversion command: see the Administration Manual.

 

 

Back to top

Flipbook