| 1 | #!/usr/local/bin/perl -w | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use PostScript::TextBlock; | ||
| 5 | |||
| 6 | my $tb = new PostScript::TextBlock; | ||
| 7 | |||
| 8 | $tb->addText( text => "Hullaballo in Hoosick Falls.\n", | ||
| 9 | font => 'CenturySchL-Ital', | ||
| 10 | size => 24, | ||
| 11 | leading => 100 | ||
| 12 | ); | ||
| 13 | $tb->addText( text => "by Charba Gaspee.\n", | ||
| 14 | font => 'URWGothicL-Demi', | ||
| 15 | size => 18, | ||
| 16 | leading => 36 | ||
| 17 | ); | ||
| 18 | |||
| 19 | open I, "example.txt"; | ||
| 20 | undef $/; | ||
| 21 | my $text = <I>; | ||
| 22 | $tb->addText( text => $text, | ||
| 23 | font => 'URWGothicL-Demi', | ||
| 24 | size => 14, | ||
| 25 | leading => 24 | ||
| 26 | ); | ||
| 27 | |||
| 28 | |||
| 29 | open OUT, '>psoutput.ps'; | ||
| 30 | my $pages = 1; | ||
| 31 | # create the first page | ||
| 32 | # | ||
| 33 | my ($code, $remainder) = $tb->Write(572, 752, 20, 772); | ||
| 34 | print OUT "%%Page:$pages\n"; # this is required by the Adobe | ||
| 35 | # Document Structuring Conventions | ||
| 36 | print OUT $code; | ||
| 37 | print OUT "showpage\n"; | ||
| 38 | |||
| 39 | # Print the rest of the pages, if any | ||
| 40 | # | ||
| 41 | while ($remainder->numElements) { | ||
| 42 | $pages++; | ||
| 43 | print OUT "%%Page:$pages\n"; | ||
| 44 | ($code, $remainder) = $remainder->Write(572, 752, 20, 772); | ||
| 45 | print OUT $code; | ||
| 46 | print OUT "showpage\n"; | ||
| 47 | } | ||
| 48 |