1. Produkter
  2.   PDF
  3.   Perl
  4.   PDF-Create
 
  

Free Perl API to Generate, Edit & Convert PDF Files

Open Source Perl Library allows Software Professionals to Create, Edit, Optimize, Split/Merge PDF Files Programmatically inside Perl apps.

PDFs (Portable Document Format) have become the standard for sharing and presenting digital documents across different platforms and devices. Generating and managing PDFs programmatically is a common requirement in various software projects. In the Perl ecosystem, one library that has gained popularity for this task is PDF-Create. It is a Perl module that allows software developers to create PDF documents programmatically, offering a wide range of functionalities to customize the layout, text, graphics, and more. It simplifies the process of generating PDFs, providing an easy-to-use interface for developers.

PDF-Create can be extended using Perl's object-oriented features, making it easy to customize and cater to specific project requirements. As a Perl module, pdf-create runs on all major operating systems, ensuring platform independence for developers. There are several important features part of the library such as generating PDF from the scratch, adding text to the PDF, readable documents generation, adding images and graphics within the PDF, controlling various page layout options, adding page margins, adding tables to PDF, the addition of hyperlinks and bookmarks and so on.

PDF-Create is a powerful and user-friendly Perl library that streamlines PDF generation and management for software developers. As a Perl module, pdf-create runs on all major operating systems, ensuring platform independence for developers. Its rich features, ease of use, and platform independence make it an excellent choice for anyone seeking to create dynamic PDF documents inside Perl-based applications. Whether you're generating reports, invoices, or any other PDF content, PDF-Create proves to be a valuable tool in your arsenal.

Previous Next

Getting Started with PDF-Create

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

Install PDF-Create Library via CPAN

$ composer require PDF-Create/PDF-Create

You can download it directly from GitHub.

PDF Document Creation via Perl API

The PDF-Create library enables software developers to create new PDF documents and manage existing ones inside their own Perl applications. The library boasts a straightforward API, enabling software developers to generate PDFs without getting bogged down in complex configurations. The library supports features like adding text, inserting images or other graphic elements, adding new page, adding headers and footers, Page Layout Customization supports and so on. The library is very easy to handle and even Perl developers with little to no experience in PDF generation can quickly get started. The following example shows how software developers can create a new PDF document inside their Perl apps.

How to create a new PDF document via Perl API?

use PDF::Create;

// create a new PDF document:

my $pdf = PDF::Create->new(
    'filename' => 'example.pdf',
    'Version'  => '1.2',
    'PageMode' => 'UseNone',
    'Author'   => 'John Doe',
    'Title'    => 'My Sample PDF',
);

//Adding content to PDFs

my $page = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
my $font = $pdf->font('Subtype' => 'Type1', 'Encoding' => 'WinAnsi', 'BaseFont' => 'Helvetica-Bold');
$page->stringc($font, 20, 300, 500, 'Welcome to pdf-create!');

Page Layout Customization via Perl API

The open source PDF-Create library has provided various features for handling PDF page layout inside their Perl applications. The library allows users to control various page layout options, such as page size, orientation (portrait or landscape), margins, and page numbering. This flexibility is invaluable when creating PDFs for specific purposes, like reports or brochures.

Text and Font Manipulation in Perl Apps

The open source PDF-Create library has included complete support for managing text and fonts inside their Perl applications. The library has provided several important features enabling users to easily add text to the PDF and customize the font, size, color, alignment, and style. This feature is crucial for creating aesthetically appealing and readable documents. Moreover, representing tabular data is made easy and the library supports the creation of tables, enabling developers to display data in a structured and organized manner as well as adding table of content. The following example shows how software developers can manage fonts inside their Perl applications with just a couple of commands.

How to Manage Fonts or Text in PDF via Perl API?

# How to Manage fonts
        my $f1 = $pdf->font('Subtype'  => 'Type1',
                            'Encoding' => 'WinAnsiEncoding',
                            'BaseFont' => 'Helvetica');
        my $f2 = $pdf->font('Subtype'  => 'Type1',
                            'Encoding' => 'WinAnsiEncoding',
                            'BaseFont' => 'Helvetica-Bold');

#How Manage a Table of Content

        my $toc = $pdf->new_outline('Title' => 'Document',
                                    'Destination' => $page);
        $toc->new_outline('Title' => 'Section 1');
        my $s2 = $toc->new_outline('Title' => 'Section 2');
        $s2->new_outline('Title' => 'Subsection 1');

        $page->stringc($f2, 40, 306, 426, "PDF::Create");
        $page->stringc($f1, 20, 306, 396, "version $PDF::Create::VERSION");
 Svenska