NAME

PDF::Make::Page - PDF page object

SYNOPSIS

use PDF::Make::Document;
use PDF::Make::Page qw(:fonts);
use PDF::Make::Canvas;

my $doc = PDF::Make::Document->new;
my $page = $doc->add_page(612, 792);  # Letter size

# Add fonts to the page
$page->add_std14_font('F1', HELVETICA);
$page->add_font('F2', 'MyFont');

# Create content with a Canvas
my $canvas = PDF::Make::Canvas->new;
$canvas->BT
       ->Tf('F1', 12)
       ->Td(72, 720)
       ->Tj('Hello, World!')
       ->ET;

# Set the page content
$page->set_content($canvas->to_bytes);

# Write the PDF
my $bytes = $doc->to_bytes;

DESCRIPTION

PDF::Make::Page represents a page in a PDF document. Pages are created via PDF::Make::Document->add_page() and are owned by the document.

METHODS

add_font

$page->add_font($name, $base_font);

Add a font resource to the page. $name is the resource name (e.g., 'F1') used in content streams, and $base_font is the font name.

add_std14_font

use PDF::Make::Page qw(:fonts);
$page->add_std14_font('F1', HELVETICA);

Add one of the PDF standard 14 fonts to the page. These fonts are guaranteed to be available in all PDF readers without embedding.

set_content

$page->set_content($bytes);

Set the page content stream. $bytes should be valid PDF content stream operators, typically generated by PDF::Make::Canvas.

CONSTANTS

The following constants are available for the standard 14 fonts:

Serif fonts (Times)

  • TIMES_ROMAN

  • TIMES_BOLD

  • TIMES_ITALIC

  • TIMES_BOLDITALIC

Sans-serif fonts (Helvetica)

  • HELVETICA

  • HELVETICA_BOLD

  • HELVETICA_OBLIQUE

  • HELVETICA_BOLDOBLIQUE

Monospace fonts (Courier)

  • COURIER

  • COURIER_BOLD

  • COURIER_OBLIQUE

  • COURIER_BOLDOBLIQUE

Symbol fonts

  • SYMBOL

  • ZAPFDINGBATS

SEE ALSO

PDF::Make::Document, PDF::Make::Canvas