1. Products
  2.   PDF
  3.   Perl
  4.   PDFAPI2

Free Perl API for PDF Files Creation, Editing & Conversion

Open Source Perl API that enables Software Developers to Generate, Edit, Merge, Convert, Examine, Encrypt and Manipulate PDF Documents inside Perl Applications.

In the world of software development and engineering, open source libraries always play an important role in simplifying complex tasks and encouraging collaboration among software developers and engineers. These libraries are am evidence to the spirit of open collaboration and community driven origination. PDFAPI2, a very powerful open source library available on GitHub, simplifies the process of creating and manipulating PDF files in Perl. The library is designed to smoothly work on multiple platforms, including Windows, macOS, Linux and many more. Due to this cross-platform compatibility software professionals consider it a valuable asset for working in different environments.

PDFAPI2 is an open source library designed to create and manipulate PDF documents without any external dependencies. It provides software developers with a powerful set of tools for generating, editing, and interacting with PDF files in various programming languages including Perl. Whether you need to generate invoices, reports, or interactive forms, the library offers a versatile solution. There are several important features part of the library, such as generating PDFs from the scratch, modifying existing PDF files, examining PDF files, handling text and graphics in PDFs, extracting PDF pages, merge multiple PDFs, rotate pages inside PDFs and many more.

Open source libraries like DFAPI2 epitomize the spirit of collaboration and innovation in the world of software development. It is a versatile and powerful open source Perl library that simplifies PDF generation and manipulation. Whether software developers need to create PDFs from scratch or modify existing ones, this library provides the tools they need to work with PDF documents programmatically. Give it a try in your next Perl project and unlock the potential of PDF generation and manipulation with ease.

Previous Next

Getting Started with PDFAPI2

The recommend way to install DFAPI2 is using CPAN. Please use the following command for a smooth installation.

Install DFAPI2 via CPAN

perl -MCPAN -e 'install PDF::API2'

You can download it directly from GitHub.

PDF Generation via Perl API

The open source DFAPI2 library makes it easy for software developers to generate PDFs from scratch with just a couple of lines of Perl code. Software developers can create new pages, add text, images, and shapes, and specify page layouts and dimensions. This is incredibly useful for tasks like generating invoices, reports, or certificates dynamically inside Perl applications. The following example shows how software developers can create a new PDF documents and add new page inside it and save the PDF file.

How to Create a New PDF File using Perl API?

use PDF::API2;

# Create a new PDF document
my $pdf = PDF::API2->new();

# Add a page
my $page = $pdf->page();
my $text = $page->text();
$text->text("Hello, pdfapi2!");

# Save the PDF to a file

Manage Text & Graphics in PDF via Perl

The DFAPI2 library provides extensive support for working with text and graphics in PDFs. The library has included complete support for adding and managing text as well as graphics inside PDF documents using Perl API. Users can specify fonts, font sizes, colors, and positioning to create visually appealing documents. Additionally, the library supports various image formats, making it easy to embed images into your PDFs. The following example demonstrates how to add an image as well as text inside PDF documents using Perl API.

How to Add Images as well as Text inside PDF inside Perl Apps?

use PDF::API2;

# Create a new PDF document
my $pdf = PDF::API2->new();

# Add an image
my $page = $pdf->page();
my $gfx = $page->gfx;
$gfx->image('image.png', 100, 100);

# Add text
my $text = $page->text();
$text->font($pdf->corefont('Helvetica-Bold'), 20);
$text->text("Hello, pdfapi2!");

# Save the PDF

PDF Manipulation & Encryption via Perl

The open source DFAPI2 library makes is for software developers to load and manipulate PDF documents using Perl library. Software developers can extract pages, merge PDFs, rotate pages, and update text and graphics. This feature is particularly valuable when users need to update or customize existing PDF documents. It offers encryption capabilities to protect your PDFs from unauthorized access. The following example shows how to manipulate PDF documents inside Perl applications.

How to Manipulate PDF Documents using Perl API?

use PDF::API2;

# Open an existing PDF document
my $pdf = PDF::API2->open('existing.pdf');

# Extract a page
my $page = $pdf->openpage(1);

# Rotate the page

# Save the modified PDF