comparison src/kaigo/fwgo/atena.pl @ 57:05f3d51ad966

add fwgo.
author pyon@macmini
date Wed, 15 Jul 2020 18:18:24 +0900
parents
children
comparison
equal deleted inserted replaced
56:7396e7407abd 57:05f3d51ad966
1 # あてなをつくる
2 # Last Change: 2020-07-15 水 15:55:32.
3 #
4 # C:\> perl atena.pl input.pdf output.pdf
5 #
6
7 use utf8;
8 use PDF::API2;
9
10 my $bg_file = 'bg.pdf';
11
12 my ($in_file, $out_file) = ($ARGV[0], $ARGV[1]);
13 if ($in_file eq '' || $out_file eq '') {
14 print "bad arguments.\n";
15 exit;
16 }
17
18 my $new_pdf = PDF::API2->new();
19
20 my $in_pdf = PDF::API2->open($in_file);
21 my $bg_pdf = PDF::API2->open($bg_file);
22 for my $p (1..$in_pdf->pages) {
23 my $page = $new_pdf->page();
24 $page->mediabox('A4');
25 my $gfx = $page->gfx();
26
27 # send to
28 my $xo = $new_pdf->importPageIntoForm($in_pdf, $p);
29 $gfx->formimage($xo, 15, 615, 0.9);
30
31 # background
32 $xo = $new_pdf->importPageIntoForm($bg_pdf, 1);
33 $gfx->formimage($xo, 0, 0, 1.0);
34 }
35 $new_pdf->saveas($out_file);
36 $new_pdf->end;
37 $in_pdf->end;
38 $bg_pdf->end;
39