📄 01_document_n_pages-pl
字号:
#!/usr/bin/perl -wuse PDF::API2;$pdf=PDF::API2->new;$font=$pdf->corefont('Helvetica',1);$font->encode('latin1');foreach $med ( [ 0, 0, 595, 842, 0, 0, "This Page is A4" ], [ 0, 0, 595, 842, 100, 0, "This Page is A4" ], [ 0, 0, 595, 842, 100, 1, "This Page is A4", "but copped !" ], [ 0, 0, 500, 800, 0, 0, "This Page is Custom" ], [ 0, 0, 500, 800, 100, 0, "This Page is Custom" ], [ 0, 0, 500, 800, 100, 1, "This Page is Custom", "but cropped !" ], [ 0, 0, 842, 1190, 0, 0, "This Page is A3" ], [ 0, 0, 842, 1190, 100, 0, "This Page is A3" ], [ 0, 0, 842, 1190, 100, 1, "This Page is A3", "but cropped !" ], ) { ($x,$y,$w,$h,$f,$c,@text)=@{$med}; $page = $pdf->page; $page->mediabox($x-$f,$y-$f,$w+$f,$h+$f); $page->cropbox($x,$y,$w,$h) if($c); $gfx=$page->gfx; $gfx->rect($x,$y,$w-$x,$h-$y); $gfx->stroke; $txt=$page->text; $txt->font($font,20); $txt->translate($x+10,$y+10); $txt->text("L=($x,$y)"); $txt->translate($w-10,$h-20); $txt->text_right("R=($w,$h)"); if($c) { $txt->translate($x+10,$h-20); } else { $txt->translate($x-$f+10,$h+$f-20); } $txt->text(shift(@text)." F=($f)"); $txt->lead(20); while(scalar @text > 0) { $txt->cr; $txt->text(shift @text); }}$pdf->saveas("$0.pdf");$pdf->end();exit;__END__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -