view src/kaigo/fwgo/atena2.pl @ 64:ad5c30ee5cf1

horori: add manual.
author pyon@macmini
date Fri, 25 Dec 2020 20:48:01 +0900
parents 05f3d51ad966
children
line wrap: on
line source

# あてなをつくる(PNGバージョン)
#                   Last Change: 2020-07-15 水 15:56:39.
#
# C:\> perl atena.pl input.pdf output.pdf
#

use utf8;
use PDF::API2;

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 $img = $new_pdf->image_png('leaflet.png');
my $font = $new_pdf->cjkfont('kozmin', 1);

my $in_pdf = PDF::API2->open($in_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);

	# leaflet
	$gfx->transform(-translate => [50, 170], -scale => [0.5, 0.5]);
	$gfx->image($img);
	$gfx->transform(-translate => [0, 0], -scale => [2, 2]);

	# title
	my $s = "介護保険負担割合証の送付について";
	my $title = $page->text();
	$title->translate(160, 430);
	$title->font($font, 10.5);
	$title->text($s);

	# comment
	$s = "令和2年度介護保険負担割合証を送付いたします。";
	my $comment1 = $page->text();
	$comment1->translate(-10, 380);
	$comment1->font($font, 9.5);
	$comment1->text($s);

	$s = "所得の修正申告や世帯員の変更(65歳以上)などがあった場合は、有効期間内であっても負担割が変更になる場合があります。";
	my $comment3 = $page->text();
	$comment3->translate(-10, 365);
	$comment3->font($font, 9.5);
	$comment3->text($s);

	$s = "※ 第2号被保険者(40歳以上65歳未満の方)、市町民税非課税の方、生活保護受給者は下記にかかわらず1割負担です。";
	my $comment3 = $page->text();
	$comment3->translate(-10, 340);
	$comment3->font($font, 9.5);
	$comment3->text($s);

	# from
	$s = "大曲仙北広域市町村圏組合  介護保険事務所";
	my $from1 = $page->text();
	$from1->translate(200, -75);
	$from1->font($font, 9.5);
	$from1->text($s);

	$s = "〒014-0805 秋田県大仙市高梨字田茂木10(大仙市役所仙北庁舎3階)";
	my $from2 = $page->text();
	$from2->translate(200, -95);
	$from2->font($font, 9.5);
	$from2->text($s);

	$s = "電話 0187-86-3911";
	my $from3 = $page->text();
	$from3->translate(200, -105);
	$from3->font($font, 9.5);
	$from3->text($s);

	if (0) {
		# hhs info
		$xo = $new_pdf->importPageIntoForm($in_pdf, $p);
		$gfx->formimage($xo, 355, 330, 0.6);

		# write-box
		$gfx->rect(300, 345, 200, 100);
		$gfx->fillcolor('#ffffff');
		$gfx->fill();
	}
}

$new_pdf->saveas($out_file);
$new_pdf->end