#/usr/bin/perl use strict; use warnings 'all'; use PDF::API2; use PDF::API2::Resource::UniFont my $test = 'test.pdf'; # Create a blank PDF file my $pdf = PDF::API2->new(); # Add a blank page my $page = $pdf->page(); # Add a built-in font to the PDF my $font = $pdf->corefont('Times-Roman'); # Register a Unicode font my $ufont = PDF::API2::Resource::UniFont->new($pdf, {font => $font}); # Create a Unicode string (Greek) my @uhex = qw(03a7 03b1 03b9 03c1 03b5 0021); my @uchars = map (hex, @uhex); my $ustring = pack("U*", @uchars); # Add some text to the page my $text = $page->text(); $text->font($ufont, 20); $text->translate(80, 710); $text->text($ustring); # Save the PDF $pdf->saveas('test.pdf');