#!/usr/bin/perl

use PDF::API2;
use PDF::API2::Util;
use Text::PDF::Utils;

$pdf=PDF::API2->new;

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


$f2=$pdf->corefont('Times-Roman',1);
# $f2->encode('latin1');

$page = $pdf->page;
$page->mediabox(595,842);

$txt=$page->text;
$txt->compress;

$txt->translate(100,800);
$txt->font($f1,30);
$txt->text('Barcode Test !');


$gfx=$page->gfx;
# $gfx->compress;

$bar=$pdf->barcode(
	-type => '3of9',
	-font => $f1,
	-code => '010203045678909',
	-quzn => 20,
	-umzn => 10,
	-lmzn => 10,
	-zone => 30,
	-spcr => ' ',
);

$gfx->barcode($bar,$bar->{' w'}/2,100,1,1);

$y=200;

foreach $t (
	'(00) 38431853003496706',
	'(00) 384318530034967067',
	'(02) 08412345678905 (37) 23',
	'(01) 18410020706513 (20) 70',
	'(01) 08412345678905 (10) 4512XA (00) 384123451234567899 (15) 930120',
	'(01) 08412345678905 (10) 451XA2 (00) 384123451234567899 (15) 930120'
) {
	$bar=$pdf->barcode(
		-type => 'ean128',
		-font => $f2,
		-code => $t,
		-quzn => 20,
		-umzn => 0,
		-lmzn => 0,
		-zone => 20,
		-fnsz => 8,
		-text => $t
	);
#	$bar->compress;
	$gfx->barcode($bar,$bar->{' w'}/2,$y,1,1);
	$y+=70;
}

$pdf->saveas("$0.pdf");

exit;

__END__
