The PostScript::Document module comes with the PostScript package. It creates an abstract interface for creating generic multiple page textual documents. You can think of a Document object as a big text block with additional attributes and methods that allow it to span multiple pages. You can also include page numbers, and textual headers and footers that appear on each page of the document.
The Document object is used in a similar manner to the TextBlock object to do the following:
Instantiate a new document with the
method and a number of optional parameters defining the attributes of
Add text elements to the document with the
Create the PostScript as a string of code with the
Write the code to a file, and pipe or append it to other code.
A sample script using this module that reads a text file and appends a title, header, and footer to it would look something like this:
#!/usr/bin/perl -w use strict; use PostScript::Document; my $doc = new PostScript::Document; $doc->addText( text => "Hullabalo in Hoosick Falls.\n", font => 'CenturySchL-Ital', size => 24, leading => 100 ); $doc->addText( text => "by Charba Gaspee.\n", font => 'URWGothicL-Demi', size => 18, leading => 36 ); $doc->addHeader(text => "Hullabaloo in Hoosick Falls", font => 'URWGothicL-Demi', size => 9, leading => 11 ); $doc->addFooter(text => "Page ##Page", font => 'URWGothicL-Demi', size => 9, leading => 11 ); # Now read ...