Markus Baertschi > PDF-Create-1.04 > PDF::Create

Download:
PDF-Create-1.04.tar.gz

Dependencies

Annotate this POD (1)

Related Modules

PDF::API2
PDF::Labels
PDF::Template
PDF::Reuse
Text::Wrap
CGI::Carp
Compress::Zlib
Win32::OLE
HTML::Template
Class::DBI
more...
By perlmonks.org

CPAN RT

New  1
Open  3
View/Report Bugs
Module Version: 1.04   Source   Latest Release: PDF-Create-1.10

NAME ^

PDF::Create - create PDF files

SYNOPSIS ^

  use PDF::Create;

  my $pdf = new PDF::Create('filename'     => 'mypdf.pdf',
                            'Version'      => 1.2,
                            'PageMode'     => 'UseOutlines',
                            'Author'       => 'John Doe',
                            'Title'        => 'My Title',
                            'CreationDate' => [ localtime ],
                           );
  # add a A4 sized page
  my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));

  # Add a page which inherits its attributes from $root
  my $page = $root->new_page;

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

  # Prepare 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',
                             'Status' => 'closed');
  $s2->new_outline('Title' => 'Subsection 1');

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

  # Add another page
  my $page2 = $root->new_page;
  $page2->line(0, 0, 612, 792);
  $page2->line(0, 792, 612, 0);

  $toc->new_outline('Title' => 'Section 3');
  $pdf->new_outline('Title' => 'Summary');

  # Add something to the first page
  $page->stringc($f1, 20, 306, 300, 'by John Doe <john.doe@example.com>');

  # Add the missing PDF objects and a the footer then close the file
  $pdf->close;

DESCRIPTION ^

PDF::Create allows you to create PDF documents using a number of primitives. The result is as a PDF file or stream.

PDF stands for Portable Document Format.

Documents can have several pages, a table of content, an information section and many other PDF elements.

Methods ^

Page methods

This section describes the methods that can be used by a PDF::Create::Page object.

In its current form, this class is divided into two main parts, one for drawing (using PostScript like paths) and one for writing.

Some methods are not described here because they must not be called directly (e.g. new and add).

Low level drawing methods

SEE ALSO ^

PDF::Create::Page, http://www.adobe.com/devnet/pdf/pdf_reference.html http://github.com/markusb/pdf-create

AUTHORS ^

Fabien Tassin (fta@sofaraway.org)

GIF and JPEG-support: Michael Gross (info@mdgrosse.net)

Maintenance since 2007: Markus Baertschi (markus@markus.org)

COPYRIGHT ^

Copyright 1999-2001, Fabien Tassin. All rights reserved. It may be used and modified freely, but I do request that this copyright notice remain attached to the file. You may modify this module as you wish, but if you redistribute a modified version, please attach a note listing the modifications you have made.

Copyright 2007-, Markus Baertschi

syntax highlighting: