PostScript::File(3pm) User Contributed Perl Documentation PostScript::File(3pm)
NAME
PostScript::File - Class for creating Adobe PostScript files
VERSION
This document describes version 2.20 of PostScript::File, released February 11, 2012 as part of PostScript-File version 2.20.
Attributes and methods added since version 2.00 are marked with the version they were added in (e.g. "(v2.10)"). Because there were
significant API changes in 2.00, I recommend that any code using PostScript::File specify a minimum version of at least 2.
SYNOPSIS
Simplest
A 'hello world' program:
use PostScript::File 2;
my $ps = PostScript::File->new(reencode => 'cp1252');
$ps->add_to_page( <<END_PAGE );
/Helvetica findfont
12 scalefont
setfont
72 300 moveto
(hello world) show
END_PAGE
$ps->output( "test" );
All options
my $ps = PostScript::File->new(
paper => 'Letter',
height => 500,
width => 400,
bottom => 30,
top => 30,
left => 30,
right => 30,
clip_command => 'stroke',
clipping => 1,
eps => 1,
dir => '~/foo',
file => "bar",
landscape => 0,
headings => 1,
reencode => 'cp1252',
font_suffix => '-iso',
need_fonts => [qw(Helvetica Helvetica-Bold)],
errors => 1,
errmsg => 'Failed:',
errfont => 'Helvetica',
errsize => 12,
errx => 72,
erry => 300,
debug => 2,
db_active => 1,
db_xgap => 120,
db_xtab => 8,
db_base => 300,
db_ytop => 500,
db_color => '1 0 0 setrgbcolor',
db_font => 'Times-Roman',
db_fontsize => 11,
db_bufsize => 256,
);
DESCRIPTION
PostScript::File is a class that writes PostScript files following Adobe's Document Structuring Conventions (DSC). You should be familiar
with the DSC if you're using this class directly; consult the PostScript Language Document Structuring Conventions Specification linked to
in "SEE ALSO".
There are also a number of modules that build upon PostScript::File to produce various kinds of documents without requiring knowledge of
PostScript. These are listed in "SEE ALSO".
It is possible to construct and output files in either normal PostScript (*.ps files) or as Encapsulated PostScript (*.epsf or *.epsi
files). By default a minimal file is output, but support for font encoding, PostScript error reporting and debugging can be built in if
required.
Documents can typically be built using only these functions:
new The constructor, with many options
add_procset Add PostScript functions to the prolog
add_to_page Add PostScript to construct each page
newpage Begins a new page in the document
output Construct the file and saves it
The rest of the module involves fine-tuning this. Some settings only really make sense when given once, while others can control each page
independently. See "new" for the functions that duplicate option settings, they all have "get_" counterparts. The following provide
additional support.
get/set_bounding_box
get/set_page_bounding_box
get/set_page_clipping
get/set_page_landscape
set_page_margins
get_pagecount
draw_bounding_box
clip_bounding_box
The functions which insert entries into each of the DSC sections all begin with 'add_'. They also have "get_" counterparts.
add_comment
add_preview
add_default
add_resource
add_procset
add_setup
add_page_setup
add_to_page
add_page_trailer
add_trailer
Finally, there are a few stand-alone functions. These are not methods and are available for export if requested.
check_tilde
check_file
incpage_label
incpage_roman
Hyphens and Minus Signs
In ASCII, the character "x2D" ("