Pageflip5 documentation

Licensed PDF converter + API

Licensed PDF converter is the same tool as the online PDF converter 2 except you can install it to your web server, so you can benefit of its maximum processing power to make more books in less time. With the included API you can automate PDF creation from your website.

Important: check system requirements, and test your server before making purchase of the Licensed PDF to Pageflip 5 converter!

System requirements

  • Unix based web server with PHP 5.3+ and ImageMagick 6.7+ installed.
  • Executing PHP script using the exec PHP command.
  • MySQL database access
There are also a few php.ini settings needed to run the converter and the converter API without issues:

Testing server

Download test script, unzip the package, then open the test_server.php file and set your database connetion parameters in the file (it is well commented), finaly save the changes.

Upload test_server.php file to your web server, and load it from a browser.

If all the setting are matching with the required values, and no error message is displayed, your server is ready to run the Licensed PDF converter and the converter API.

Install PDF converter

To install the converter, just upload the whole content of the pageflip5_converter_package folder, which is a subfolder of the downloaded and unzipped pageflip5+converter package.

After uploading is finished, open the lib/settings_sample.php file, and set up your converter by setting database access, and the default Keys used. When finished, save your file as settings.php in the same (lib) folder.

Your converter and the converter API is now ready to use.

Usage of the PDF converter

The Usage of the Licensed PDF converter is the same as of the online version, except that there is no Authentication at the start, and you need to provide a Key, instead of setting target domain directly.

PDF converter API

The converter API can be accessed from Javascript. There you can set all the parameters needed for a conversion, then call the converter API, and the PDF conversion will start in the background. You can monitor the progress of the conversion from Javascript, and once done, you can use the generated book.

Getting started

Open converttest.html from the downloaded package in an editor.

For the simplicity's sake, the javascript codes are embedded in this html file.

The script have 2 main parts, the first starts the conversion in the background, the second is a loop that monitors the background process.

Before starting a PDF conversion, you have to set up the process by configuring the import options and the config options.

Import Options

Import Options, Optional, if missing, default values are used for conversion. Role: These settings defines the way how the PDF is handled. You can define the importoptions object as follows:

spreads: "Auto"
Options are: "Auto", "Off", "Horizontal", "Vertical" (Case sensitive!).
rotation: "Auto"
Options are: "Auto", "Off", "All".
scale: "Fit"
Options are: "Fit", "Fill", "Noscale".

spreads:

  • Auto: If the PDF contains spreads (double pages), the converter splits them automatically
  • Off: If the PDF contains spreads (double pages), the converter scales them to a single page (by the way defined in scale)
  • Horizontal, Vertical: The converter splits all pages in the selected orientation

rotation:

  • Auto: If the PDF contains rotated pages, the converter rotates them
  • Off: If the PDF contains rotated pages, the converter scales them to a single page (by the way defined in scale)
  • All: The converter rotates all pages by 90 degree

scale: (have effect only if the PDF contains pages with different sizes)

  • Fit: Fit the PDF page on the book's page
  • Fill: The book's page is filled with the PDF page, keeping the original aspect ratio
  • Noscale: The PDF page is copied to the book's page without scaling

Config Options

Config Options, Optional, if missing, default values are used for conversion. Role: These are the Converted Pageflip setup's configuration options. These options are not the same as the Pageflip5 template's configuration options! You can define the configoptions object as follows: (this example only shows a few options from the available list, see them just below the example)

The list of the available config options with their default value and role:

dropshadow: true
Enable/Disable dropshadow behind the book
dropshadowopacity: 0.25
Dropshadow opacity (0-1)
pageshadow: true
Enable/Disable shadows on the pages
pageshadowopacity: 0.25
Page shadow opacity (0-1)
backgroundcolor: "#444"
Background color
backgroundenabled: true
Enable/Disable background. Disable it if you embed pageflip over a background image.
pagebackgroundcolor: "#888"
The coor of the pages before content is loaded
controlscolor: "rgba(255,255,255,0.5)"
Color of the control bar buttons
controlshoveredcolor: "#FA0"
Hover color of the controls
controlbarbackcolor: "rgba(68,68,68,0.35)"
Controlbar backgound color
controlbarbackenabled: true
Enable/Disable control bar background
RTL: false
Right to Left flipping direction
vertical: false
Vertical flipping direction
singlepagemode: false
Enable/Disable single page mode
hardcover: true
Enable/Disable hard cover for the book
hardpages: false
Enable/Disable hard inside pages
centersinglepage: true
Center book if only a single page is visible (front/back covers)
roundedcorners: false
Enable/Disable rounded corners
alwaysopened: false
Enable/Disable always opened book
controlbar: true
Enable/Disable the control bar
controlbartop: true
Control bar over the book (flipping pages goes behind the controls)
mousecontrol: true
Enable/Disable mouse control of the book
controlbarbtn: true
Enable/Disable control bar navigatiion
pagerenabled: true
Enable/Disable page number display
hotkeys: true
Enable/Disable keyboard control of the book
thumbenabled: true
Enable/Disable thumbnails
thumbautohide: true
Enable/Disable auto hiding thumbnails
thumbtop: true
Enable/Disable thumbnails over the book
fullscreenenabled: true
Enable/Disable fullscreen switch
autoflipenabled: true
Enable/Disable auto flipping
startautoflip: false
Start book with auto flipping enabled
sharepinterest: true
Enable/Disable Pinterest button
sharefacebook: true
Enable/Disable Facebook button
sharetwitter: true
Enable/Disable Twitter button
sharegoogle: true
Enable/Disable Google+ button
sharemsg: "PDF to flipbook converter https://pageflip-books.com"
Shared message
sharevia: "@MaccPageFlip"
Twitter Via
sharepageimage: 1
Share with image of the selected page
showcopyright: false
Enable/Disable copyright text display
keyfile: ""
If set, an external key file will be used
copyright: ""
Copyright text (if not set, default text is used)
key: ""
Key (if not set, default key is used)
datafolder: "pageflipdata/"
Pageflip external content folder

After setting up these options, you can start the PDF conversion

Start the conversion

The POST variables sent to the convertpdf.php PHP script are described in the following table with their default value (if have any) and role. If a variable is not defined, default value is used.

file
Path and file name of the PDF file to convert. This file should be located on the same server as the converter tool.
url
URL of the PDF file to convert.
output: "output"
The output directory where the pageflip book will be copied. The Book itself is enclosed in a folder named based on the bookid.
log: false
Enable/Disable logging to file (The PDF parser will output details about the PDF)
importoptions
Optional, see details below.
configoptions
Optional, see details below.
maxwidth: 600
The maximum width of the page
maxheight: 600
The maximum height of the page
thumbheight: 100
Height of the thumbnail images
threads: 1
Processor threads used for conversion.
quality: 2
Supersampling quality (n^2): can be 1, 2, 3 or 4
jpgquality: 90
JPG quality 1-100 (100 is the best quality)
embedded: true
Enable/Disable embedding of external html content, like page definitions and the control bar. Embed is needed if you plan to use pageflip offline.
bookid: "mypageflip"
Book id, is used as name for the pageflip folder on the server, and also as selector for CSS styles.
bookname: "My Pageflip"
Name of the book

At this point a conversion is running on your own server. Depending on the source PDF, and its location, the conversion time may change from a few seconds up to 10-20 minutes. For this reason you can monitor the progress of a conversion job. A successfull conversion request (sent to convertpdf.php) will return a JobID, which is the only parameter you have to send to the convertpdf_progress.php, which will return the current progress of a job in percent.