#!/usr/bin/perl -w

use PDF::API2;

$pdf=PDF::API2->new;

$f1=$pdf->corefont('Helvetica',1);

foreach $fn (glob("*.pfb")) {

	$ff=$fn;
	$ff=~s/\.pfb$/.afm/;

	$font=$pdf->psfont($fn,$ff);

	foreach $fe (qw(
		adobe-standard	cp437	cp850	latin1
	)) {

		$fen=$font->clone($fe);
		$fen->encode($fe);

		$page = $pdf->page;
		$page->mediabox(595,842);
		$txt=$page->text;
		$txt->compress;
		$txt->translate(100,700);
		$txt->font($fen,50);
		$txt->lead(50);
		$txt->text('Hello World !');
		$txt->cr;
		$txt->font($f1,20);
		$txt->text("This is font: $fn ($fe)");

		$txt->font($fen,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;

__END__
