NAME
Prima::PS::PostScript - PostScript interface to Prima::Drawable
SYNOPSIS
Recommended usage:
use
Prima::PS::Printer;
my
$x
= Prima::PS::File-> new(
file
=>
'out.ps'
);
or
my
$x
= Prima::PS::FileHandle-> new(
handle
=> \
&STDOUT
);
Low-level:
my
$x
= Prima::PS::PostScript-> create(
onSpool
=>
sub
{
open
F,
">> ./test.ps"
;
F
$_
[1];
close
F;
});
Printing:
die
"error:$@"
unless
$x
-> begin_doc;
$x
-> font-> size( 30);
$x
-> text_out(
"hello!"
, 100, 100);
$x
-> end_doc;
DESCRIPTION
Implements the Prima library interface to PostScript level 2 document language. The module is designed to be compliant with the Prima::Drawable interface. All properties' behavior is as same as Prima::Drawable's except those described below.
Inherited properties
- resolution
-
Can be set while the object is in the normal stage - cannot be changed if the document is opened. Applies to implementation of the fillPattern property and general pixel-to-point and vice versa calculations
- alpha
-
alpha
is not implemented
Specific properties
- copies
-
The number of copies that the PS interpreter should print
- grayscale
-
could be 0 or 1
- pageSize
-
The physical page dimension, in points
- pageMargins
-
Non-printable page area, an array of 4 integers: left, bottom, right, and top margins in points.
- reversed
-
if 1, a 90 degrees rotated document layout is assumed
Internal methods
- emit
-
Can be called for direct PostScript code injection. Example:
$x
-> emit(
'0.314159 setgray'
);
$x
-> bar( 10, 10, 20, 20);
- pixel2point and point2pixel
-
Helpers for translation from pixels to points and vice versa.
- fill & stroke
-
Wrappers for PS outline that are expected to be either filled or stroked. Apply colors, line, and fill styles if necessary.
- spool
-
Prima::PS::PostScript is not responsible for the output of the generated document, it only calls the
::spool
method when the document is closed through an::end_doc
call. By default discards the data. ThePrima::PS::Printer
class handles the spooling logic. - fonts
-
Calls Prima::Application::fonts and returns its output filtered so that only the fonts that support the
iso10646-1
encoding are present. This effectively allows only unicode output.