Created
December 1, 2012 02:30
-
-
Save issm/4180263 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.12.0; | |
use warnings; | |
use utf8; | |
use File::Spec; | |
use File::Basename; | |
use PDF::API2::Koromo; | |
use Time::Piece; | |
use Encode; | |
my $basedir = File::Spec->catdir( dirname(__FILE__) ); | |
my $fontdir = "$basedir/ttf"; | |
my $pdfdir = "$basedir/pdf"; | |
PDF::API2::Koromo->add_font_dirs( | |
'/System/Library/Fonts', | |
'/Library/Fonts', | |
"$ENV{HOME}/Library/Fonts", | |
$fontdir, | |
); | |
my $pdf = PDF::API2::Koromo->new( | |
measure => 'mm', | |
dpi => 300, | |
width => '400', | |
height => '600', | |
ttfont => 'ipag.ttf', | |
strokecolor => '#000000', | |
fillcolor => '#000000', | |
file => "$pdfdir/text.pdf", | |
); | |
my $text = << '...'; | |
何は結果どうしてもその意味人という気の中にしましだ。けっして十月を思案家ももしこの活動なけれないまでをするのでいでには説明あるでまして、はっきりには祈るですならですた。 | |
自分が知れます事はどうも一生にもしだですで。 | |
... | |
my $text2 = << '...'; | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. | |
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. | |
... | |
$pdf->roundrect( x => 0, y => 10, w => 399, h => 80, r => 0, linewidth => 2, strokecolor => '#ff3300', fillcolor => '#ffffff' ); | |
$pdf->text( x => 0, y => 10, ttfont => 'mplus-1c-regular.ttf', size => '20pt', text => $text ); | |
$pdf->text( x => 0, y => 50, ttfont => 'mplus-1c-regular.ttf', size => '20pt', char_spacing => 1, text => $text2 ); | |
$pdf->roundrect( x => 60, y => 100, w => 320, h => 120, r => 0, linewidth => 2, strokecolor => '#ff3300', fillcolor => '#ffffff' ); | |
$pdf->text( x => 60, y => 100, w => 320, ttfont => 'mplus-2p-thin.ttf', size => '24pt', text => $text ); | |
$pdf->text( x => 60, y => 160, w => 320, ttfont => 'mplus-1mn-bold.ttf', size => '24pt', char_spacing => 3, text => $text2 ); | |
$pdf->roundrect( x => 100, y => 240, w => 400, h => 220, r => 0, linewidth => 2, strokecolor => '#ff3300', fillcolor => '#ffffff' ); | |
$pdf->text( x => 100, y => 240, w => 400, ttfont => 'Ricty-Regular.ttf', size => '28pt', char_spacing => 2, text => $text ); | |
$pdf->text( x => 100, y => 320, w => 400, ttfont => 'mplus-1c-regular.ttf', size => '28pt', char_spacing => 0, text => $text2 ); | |
$pdf->text( x => 100, y => 380, w => 240, ttfont => 'ipamp.ttf', size => '28pt', char_spacing => 3, text => $text ); | |
$pdf->update(); | |
say 'done.'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment