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
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: 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:
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.
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.