Mercurial > mercurial > hgweb_kaigo.hg.cgi
view fwgo/atena.pl @ 1:743a122cae47 draft
Porori: ver.up
author | pyon <pyon@macmini> |
---|---|
date | Thu, 27 May 2021 22:01:27 +0900 |
parents | aaaa401818a1 |
children |
line wrap: on
line source
# あてなをつくる # Last Change: 2020-07-15 水 15:55:32. # # C:\> perl atena.pl input.pdf output.pdf # use utf8; use PDF::API2; my $bg_file = 'bg.pdf'; my ($in_file, $out_file) = ($ARGV[0], $ARGV[1]); if ($in_file eq '' || $out_file eq '') { print "bad arguments.\n"; exit; } my $new_pdf = PDF::API2->new(); my $in_pdf = PDF::API2->open($in_file); my $bg_pdf = PDF::API2->open($bg_file); for my $p (1..$in_pdf->pages) { my $page = $new_pdf->page(); $page->mediabox('A4'); my $gfx = $page->gfx(); # send to my $xo = $new_pdf->importPageIntoForm($in_pdf, $p); $gfx->formimage($xo, 15, 615, 0.9); # background $xo = $new_pdf->importPageIntoForm($bg_pdf, 1); $gfx->formimage($xo, 0, 0, 1.0); } $new_pdf->saveas($out_file); $new_pdf->end; $in_pdf->end; $bg_pdf->end;