PDF Perl modules - How to create and manipulate PDF files

We'll show you below some PDF Perl modules which will allow you to use the PDF file format from Perl language. PDF stands for Portable Document Format and in recent years has become a recognized standard for text documents.

Any processor of such documents has integrated the possibility of export to PDF format. That is why in the Perl language you'll find a lot of modules that provide the interface with this format.

These modules provide either the creation of a simple PDF document, such as PDF::Create, or the creation of more sophisticated documents as PDF::API2.

The following will make a brief presentation of some of these PDF Perl modules, which we found more relevant.

PDF::Create - is a module made by Fabien Tassin and subsequently developed by Michael Gross and Markus Baertschi. It can be downloaded from the CPAN page:


This PDF Perl module allows you the creation of PDF documents and allows mainly:

  • creating a new pdf structure for your PDF
  • adding comments
  • adding an outline to the document
  • adding a page with certain specific parameters
  • selecting the font
  • including an image file into a document ( only gif and jpeg format)
  • methods to object type page
    • low level drawing methods (moveto, lineto, curveto, rectangle, etc.)
    • adding a sub-page
    • adding text to the current page

PDF::API2 - is a module made by Alfred Reibenschuh and can be downloaded from the CPAN accessing the page:


This PDF Perl module allows the creation and modification of complex PDF-type files. It has a large number of methods, marked by numerous examples, useful in implementing the module. Among them we mention:

  • generic methods (creating a new pdf object, opening to modify an existing PDF file, controls-viewing preferences, page mode options, etc.)
  • page specific methods
  • font selecting methods
  • image files methods (jpeg, tiff, pnm, png, gif, gd)
  • colorspace methods
  • barcode type objects creating methods
  • adding new resource to the global pdf tree, if they are not handled by the font, image, shade or space methods

PDF::Reuse - is a module designed by Lars Lundberg and can be downloaded from the CPAN at:


page address. The module can be used to produce PDF documents similar to some ones already existing, through reuse templates, JavaScripts or some other components. The idea is to use a commercial visual tool (like Adobe Acrobat) to produce single PDF files which you can use as templates and mass produce file from them. The module works very fast, being able to produce many pages per second and very big PDF documents if necessary. It has a tutorial which will help you implement its methods.

PDF::Extract - is a module designed by Noel Sharrock and can be downloaded at:


It allows the extraction of PDF sub-documents from a multi page PDF document. Extracting a new PDF document can be done mainly by accessing the following methods, called with or without parameters:

  • assigning the new PDF to a scalar variable
  • saving the file to disk
  • printing the new file to STDOUT as a PDF web document
  • caching and serving it to a faster PDF web document service

The module treats a PDF file as a flat file and not as a file in PDF format, the extracted objects remain exactly as they were in the original document and therefore there will be gaps in the sequence number object (allowed in the PDF specification format).

Related links:

Perl ZIP File

Perl Plotting

Image Magick Perl

PDF Perl

return from Perl Modules to Home Page