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

add fwgo.
author pyon@macmini
date Wed, 15 Jul 2020 18:18:24 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/kaigo/fwgo/atena.pl	Wed Jul 15 18:18:24 2020 +0900
@@ -0,0 +1,39 @@
+# あてなをつくる
+#                   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;
+