PDF generator

The digilib PDFGenerator servlet creates custom PDF documents from images on the server for download by the user. The user can specify the sequence of images, the image resolution and information for the generated cover page of the document. The frontend will reload the status page until the document has been generated and then download the document. Generated documents will be cached on the server to speed up subsequent requests for the same document.


The PDFGenerator servlet and its frontend are built by the pdf and frontend-pdf modules. You can add both to the manual build process using the -Ppdf option but it is easier to include the generated artifacts the pom.xml of your own Maven project:


(see https://github.com/robcast/digilib-frontend-template for a basic setup)


The PDFGenerator servlet accepts the first request as a HTTP POST request with the following parameters:

image directory path name (required)
image sequence specification (required) examples: “1-” (all pages), “1-5”, “5,10,15”, “1-7,9-13”
pixel image width (optional)
pixel image height (optional, default 500)
url of header logo for cover page (optional)
header title for cover page (optional)
header subtitle for cover page (optional)
document title for cover page (optional)
document author for cover page (optional)
document date for cover page (optional)
document full reference for cover page (optional, alternative to title, author, date)
footer online url for cover page (optional)

The very simple but functional HTML form /pdf/form.jsp can be used as a starting point for customization.

The response to the first post request is a redirect to a HTTP GET request with an added docid parameter identifying the requested document. The following GET requests must provide the docid parameter and the response will be either a work-in-progress waiting page, an error page or the final document download.

The PDFGenerator servlet can also be queried as a ReST-style API. Responses will be given as JSON documents with the keys docid, status and message if the request carries the Accept header value application/json.

iText PDF license

The PDFGenerator servlet uses the iText PDF library. You can use it either under an AGPL license or request a commercial license from the vendor.