File: example.pl

package info (click to toggle)
libpostscript-perl 0.06-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 164 kB
  • ctags: 29
  • sloc: perl: 740; makefile: 5
file content (48 lines) | stat: -rw-r--r-- 1,161 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/local/bin/perl -w

use strict;
use PostScript::TextBlock;

my $tb = new PostScript::TextBlock;

$tb->addText( text => "Hullaballo in Hoosick Falls.\n",
              font => 'CenturySchL-Ital',
              size => 24,
              leading => 100 
             );
$tb->addText( text => "by Charba Gaspee.\n",
              font => 'URWGothicL-Demi',
              size => 18,
              leading => 36 
             );

open I, "example.txt";
undef $/;
my $text = <I>;
$tb->addText( text => $text,
              font => 'URWGothicL-Demi',
              size => 14,
              leading => 24 
             );


open OUT, '>psoutput.ps';
my $pages = 1;
# create the first page
#
my ($code, $remainder) = $tb->Write(572, 752, 20, 772);
print OUT "%%Page:$pages\n";      # this is required by the Adobe 
                                  # Document Structuring Conventions
print OUT $code;
print OUT "showpage\n";

# Print the rest of the pages, if any
#
while ($remainder->numElements) {
    $pages++;
    print OUT "%%Page:$pages\n";
    ($code, $remainder) = $remainder->Write(572, 752, 20, 772);
    print OUT $code;
    print OUT "showpage\n";
}