|
#!/usr/bin/perl -w
$pdf =PDF::API2->new;
$f1 = $pdf ->corefont( 'Helvetica' ,1);
foreach $fn ( glob ( "*.ttf" )) {
$font = $pdf ->ttfont( $fn );
foreach $fe ( qw(
adobe-standard cp437 cp850 latin1
) ) {
$font ->encode( $fe );
$page = $pdf ->page;
$page ->mediabox(595,842);
$txt = $page ->text;
$txt ->compress;
$txt ->translate(100,700);
$txt ->font( $font ,50);
$txt ->lead(50);
$txt ->text( 'Hello World !' );
$txt ->cr;
$txt ->font( $f1 ,20);
$txt ->text( "This is font: $fn ($fe)" );
$txt ->font( $font ,20);
foreach $x (0..15) {
foreach $y (0..15) {
$txt ->translate(50+(33 *$x ),50+(33 *$y ));
$txt ->text( chr ( $y *16+ $x ));
}
}
}
}
$pdf ->saveas( "$0.pdf" );
$pdf ->end();
exit ;
|