#!/usr/bin/perl -w use strict; use v5.14; use lib "template_stuff"; use utils1; use Path::Class; use PDF::API2; my $ts = "template_stuff"; my $images = "aimages"; my $captions = "captions"; my $to_windows = '/media/fred/Windows8_OS/Documents and Settings/Fred/Documents'; my @months = qw(January February March April May June July August September October November December); my @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); print "$mday $months[$mon] $days[$wday]\n"; my $day = $mday + 1; my $yr = $year +1900; my $header = "List for $days[$wday+1], $months[$mon -1] $day, $yr"; my $pdf = PDF::API2->new( width => 595, # A4 dimensions in point height => 842, # 1 point = 1/72 inch ); sub drawline { my ($line, $y) = @_; my $x1 = 50; my $x2 = 550; $line->linewidth(3); $line->move( $x1, $y ); $line->line( $x2, $y ); $line->stroke; } my $page = $pdf->page; my $txt = $page->text; my $font = $pdf->corefont('Times-Roman'); #my $font = $pdf->ttfont('DejaVuSans.ttf'); $txt->font($font, 32); $txt->translate(100, 650); $txt->text($header, -encoding => 'utf8'); my @task = ( 'set alarm for 8:30 --one snooze max', 'take meds', 'stretch', 'get on elliptical/shoot baskets/throw the disc/do yoga', 'eat toast/oatmeal', 'practice Buked', 'choir 10 a.m. --bring music', 'Skype 2:55 p.m.', ); my $line = $page->gfx; $txt->font($font, 20); my $vspace = 70; for my $i (0..$#task) { my $linepos = 500-($i*$vspace); my $msg = '[ ] '.$task[$i]; drawline ($line, $linepos); $txt->translate(70, $linepos+10); $txt->text($msg); } my $new_name = join ('_', $months[$mon -1], $day, $yr); say "new_name is $new_name"; my $save_file = file($to_windows, $new_name); #$pdf->saveas("$save_file.pdf"); $pdf->saveas("$new_name.pdf"); __END__