📄 04_barcode-pl
字号:
#!/usr/bin/perluse 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;}$page = $pdf->page;$page->mediabox(595,842);$txt=$page->text;$txt->compress;$txt->translate(100,800);$txt->font($f1,30);$txt->text('EAN13');$gfx=$page->gfx;# $gfx->compress;$bar=$pdf->barcode( -type => 'ean13', -font => $f1, -code => '7501031311309', -quzn => 20, -umzn => 10, -lmzn => 10, -zone => 30,);$gfx->barcode($bar,$bar->{' w'}/2,50,1,1);$pdf->saveas("$0.pdf");$pdf->end();exit;__END__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -