PSCommandMap
public class PSGenerator extends java.lang.Object implements PSCommandMap
PSProcSets.STD_PROCSET
has been added to the PostScript file.Modifier and Type | Field | Description |
---|---|---|
static java.lang.Object |
ATEND |
Deprecated.
Please use DSCConstants.ATEND.
|
static int |
DEFAULT_LANGUAGE_LEVEL |
Default postscript language level
|
static char |
LF |
Line feed used by PostScript
|
Constructor | Description |
---|---|
PSGenerator(java.io.OutputStream out) |
Creates a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
void |
commentln(java.lang.String comment) |
Writes a comment to the stream and ends the line.
|
void |
concatMatrix(double[] matrix) |
Concats the transformations matrix.
|
void |
concatMatrix(double a,
double b,
double c,
double d,
double e,
double f) |
Concats the transformation matrix.
|
void |
concatMatrix(java.awt.geom.AffineTransform at) |
Concats the transformations matric.
|
static java.lang.String |
convertRealToDSC(float value) |
Converts a <real> value for use in DSC comments.
|
static java.lang.String |
convertStringToDSC(java.lang.String text) |
Converts text by applying escaping rules established in the DSC specs.
|
static java.lang.String |
convertStringToDSC(java.lang.String text,
boolean forceParentheses) |
Converts text by applying escaping rules established in the DSC specs.
|
void |
defineRect(double x,
double y,
double w,
double h) |
Adds a rectangle to the current path.
|
boolean |
embedIdentityH() |
Embeds the Identity-H CMap file into the output stream, if that has not
already been done.
|
static void |
escapeChar(char c,
java.lang.StringBuffer target) |
Escapes a character conforming to the rules established in the PostScript
Language Reference (Search for "Literal Text Strings").
|
void |
flush() |
Flushes the OutputStream.
|
java.lang.String |
formatDouble(double value) |
Formats a double value for PostScript output.
|
java.lang.String |
formatDouble5(double value) |
Formats a double value for PostScript output (higher resolution).
|
java.lang.String |
formatMatrix(java.awt.geom.AffineTransform at) |
Formats a transformation matrix.
|
java.lang.String |
formatRectangleToArray(java.awt.geom.Rectangle2D rect) |
Formats a Rectangle2D to an array.
|
PSState |
getCurrentState() |
Returns the current graphics state.
|
PSResource |
getIdentityHCMapResource() |
Returns the PSResource instance corresponding to the Identity-H CMap
resource.
|
java.io.OutputStream |
getOutputStream() |
Returns the OutputStream the PSGenerator writes to.
|
PSResource |
getProcsetCIDInitResource() |
Returns the PSResource instance corresponding to the CIDInit ProcSet
resource.
|
int |
getPSLevel() |
Returns the selected PostScript level.
|
ResourceTracker |
getResourceTracker() |
Resturns the ResourceTracker instance associated with this PSGenerator.
|
void |
includeProcsetCIDInitResource() |
Adds a PostScript DSC comment to the output stream requiring the
inclusion of the CIDInit ProcSet resource.
|
boolean |
isCommentsEnabled() |
Indicates whether this instance allows to write comments.
|
boolean |
isCompactMode() |
Indicates whether this instance is in compact mode.
|
boolean |
isResourceSupplied(PSResource res) |
Deprecated.
Use the isResourceSupplied() on ResourceTracker instead.
|
java.lang.String |
mapCommand(java.lang.String command) |
Maps a standard PostScript command (like "setlinejoin" or "setrgbcolor") to a macro.
|
void |
newLine() |
Writes a newline character to the OutputStream.
|
void |
notifyResourceUsage(PSResource res,
boolean needed) |
Deprecated.
Use the notifyResourceUsageOnPage() on ResourceTracker instead
|
void |
notifyStartNewPage() |
Deprecated.
Use the notifyStartNewPage() on ResourceTracker instead.
|
javax.xml.transform.Source |
resolveURI(java.lang.String uri) |
Attempts to resolve the given URI.
|
boolean |
restoreGraphicsState() |
Restores the last graphics state of the rendering engine.
|
void |
saveGraphicsState() |
Saves the graphics state of the rendering engine.
|
void |
setCommentsEnabled(boolean value) |
Controls whether this instance allows to write comments using the
commentln(String)
method. |
void |
setCompactMode(boolean value) |
Controls whether this instance shall produce compact PostScript (omitting comments and
using short macros).
|
void |
setPSLevel(int level) |
Sets the PostScript level that is used to generate the current document.
|
void |
setResourceTracker(ResourceTracker resTracker) |
Sets the ResourceTracker instance to be associated with this PSGenerator.
|
void |
showPage() |
Issues the "showpage" command and resets the painting state accordingly.
|
void |
useColor(java.awt.Color col) |
Establishes the specified color.
|
void |
useDash(java.lang.String pattern) |
Establishes the specified dash pattern.
|
void |
useFont(java.lang.String name,
float size) |
Establishes the specified font and size.
|
void |
useLineCap(int linecap) |
Establishes the specified line cap style.
|
void |
useLineJoin(int linejoin) |
Establishes the specified line join style.
|
void |
useLineWidth(double width) |
Establishes the specified line width.
|
void |
useMiterLimit(float miterlimit) |
Establishes the specified miter limit.
|
void |
useRGBColor(java.awt.Color col) |
Deprecated.
use useColor method instead
|
void |
write(int n) |
Writes the given number to the stream in decimal format.
|
void |
write(java.lang.String cmd) |
Writes a PostScript command to the stream.
|
void |
writeByteArr(byte[] cmd) |
Writes encoded data to the PostScript stream.
|
void |
writeDSCComment(java.lang.String name) |
Writes a DSC comment to the output stream.
|
void |
writeDSCComment(java.lang.String name,
java.lang.Object param) |
Writes a DSC comment to the output stream.
|
void |
writeDSCComment(java.lang.String name,
java.lang.Object[] params) |
Writes a DSC comment to the output stream.
|
void |
writeln(java.lang.String cmd) |
Writes a PostScript command to the stream and ends the line.
|
void |
writeResources(boolean pageLevel) |
Deprecated.
Use the writeResources() on ResourceTracker instead.
|
public static final int DEFAULT_LANGUAGE_LEVEL
@Deprecated public static final java.lang.Object ATEND
public static final char LF
public PSGenerator(java.io.OutputStream out)
out
- the OutputStream to write the generated PostScript code topublic boolean isCompactMode()
setCompactMode(boolean)
for details.public void setCompactMode(boolean value)
PSProcSets.STD_PROCSET
) is included in the PostScript file. Setting this to
false produces more verbose PostScript suitable for debugging.value
- true to enable compact mode, false for verbose modepublic boolean isCommentsEnabled()
setCommentsEnabled(boolean)
for details.public void setCommentsEnabled(boolean value)
commentln(String)
method.value
- true to enable comments, false to disable thempublic java.io.OutputStream getOutputStream()
public int getPSLevel()
public void setPSLevel(int level)
level
- the PostScript level (currently 1, 2 and 3 are known)public javax.xml.transform.Source resolveURI(java.lang.String uri)
uri
- URI to accessSource
object, or null if the URI
cannot be resolved.public final void newLine() throws java.io.IOException
java.io.IOException
- In case of an I/O problempublic java.lang.String formatDouble(double value)
value
- value to formatpublic java.lang.String formatDouble5(double value)
value
- value to formatpublic void write(java.lang.String cmd) throws java.io.IOException
cmd
- The PostScript code to be written.java.io.IOException
- In case of an I/O problempublic void write(int n) throws java.io.IOException
n
- a numberjava.io.IOException
- in case of an I/O problempublic void writeln(java.lang.String cmd) throws java.io.IOException
cmd
- The PostScript code to be written.java.io.IOException
- In case of an I/O problempublic void commentln(java.lang.String comment) throws java.io.IOException
comment
- comment to writejava.io.IOException
- In case of an I/O problempublic java.lang.String mapCommand(java.lang.String command)
mapCommand
in interface PSCommandMap
command
- the commandpublic void writeByteArr(byte[] cmd) throws java.io.IOException
cmd
- The encoded PostScript code to be written.java.io.IOException
- In case of an I/O problempublic void flush() throws java.io.IOException
java.io.IOException
- In case of an I/O problempublic static final void escapeChar(char c, java.lang.StringBuffer target)
c
- character to escapetarget
- target StringBuffer to write the escaped character topublic static final java.lang.String convertStringToDSC(java.lang.String text)
text
- Text to convertpublic static final java.lang.String convertRealToDSC(float value)
value
- the value to convertpublic static final java.lang.String convertStringToDSC(java.lang.String text, boolean forceParentheses)
text
- Text to convertforceParentheses
- Force the use of parenthesespublic void writeDSCComment(java.lang.String name) throws java.io.IOException
name
- Name of the DSC commentjava.io.IOException
- In case of an I/O problemDSCConstants
public void writeDSCComment(java.lang.String name, java.lang.Object param) throws java.io.IOException
name
- Name of the DSC commentparam
- Single parameter to the DSC commentjava.io.IOException
- In case of an I/O problemDSCConstants
public void writeDSCComment(java.lang.String name, java.lang.Object[] params) throws java.io.IOException
name
- Name of the DSC commentparams
- Array of parameters to the DSC commentjava.io.IOException
- In case of an I/O problemDSCConstants
public void saveGraphicsState() throws java.io.IOException
java.io.IOException
- In case of an I/O problempublic boolean restoreGraphicsState() throws java.io.IOException
java.io.IOException
- In case of an I/O problempublic PSState getCurrentState()
public void showPage() throws java.io.IOException
java.io.IOException
- In case of an I/O problempublic void concatMatrix(double a, double b, double c, double d, double e, double f) throws java.io.IOException
a
- A partb
- B partc
- C partd
- D parte
- E partf
- F partjava.io.IOException
- In case of an I/O problempublic void concatMatrix(double[] matrix) throws java.io.IOException
matrix
- Matrix to usejava.io.IOException
- In case of an I/O problempublic java.lang.String formatMatrix(java.awt.geom.AffineTransform at)
at
- the AffineTransform with the matrixpublic void concatMatrix(java.awt.geom.AffineTransform at) throws java.io.IOException
at
- the AffineTransform whose matrix to usejava.io.IOException
- In case of an I/O problempublic java.lang.String formatRectangleToArray(java.awt.geom.Rectangle2D rect)
rect
- the rectanglepublic void defineRect(double x, double y, double w, double h) throws java.io.IOException
x
- upper left cornery
- upper left cornerw
- widthh
- heightjava.io.IOException
- In case of an I/O problempublic void useLineCap(int linecap) throws java.io.IOException
linecap
- the line cap style (0, 1 or 2) as defined by the setlinecap command.java.io.IOException
- In case of an I/O problempublic void useLineJoin(int linejoin) throws java.io.IOException
linejoin
- the line join style (0, 1 or 2) as defined by the setlinejoin command.java.io.IOException
- In case of an I/O problempublic void useMiterLimit(float miterlimit) throws java.io.IOException
miterlimit
- the miter limit as defined by the setmiterlimit command.java.io.IOException
- In case of an I/O problempublic void useLineWidth(double width) throws java.io.IOException
width
- the line width as defined by the setlinewidth command.java.io.IOException
- In case of an I/O problempublic void useDash(java.lang.String pattern) throws java.io.IOException
pattern
- the dash pattern as defined by the setdash command.java.io.IOException
- In case of an I/O problem@Deprecated public void useRGBColor(java.awt.Color col) throws java.io.IOException
col
- the color as defined by the setrgbcolor command.java.io.IOException
- In case of an I/O problempublic void useColor(java.awt.Color col) throws java.io.IOException
col
- the color.java.io.IOException
- In case of an I/O problempublic void useFont(java.lang.String name, float size) throws java.io.IOException
name
- name of the font for the "F" command (see FOP Std Proc Set)size
- size of the fontjava.io.IOException
- In case of an I/O problempublic ResourceTracker getResourceTracker()
public void setResourceTracker(ResourceTracker resTracker)
resTracker
- the ResourceTracker instance@Deprecated public void notifyStartNewPage()
@Deprecated public void notifyResourceUsage(PSResource res, boolean needed)
res
- the resource being usedneeded
- true if this is a needed resource, false for a supplied resource@Deprecated public void writeResources(boolean pageLevel) throws java.io.IOException
pageLevel
- true if the DSC comment for the page level should be generated,
false for the document level (in the trailer)java.io.IOException
- In case of an I/O problem@Deprecated public boolean isResourceSupplied(PSResource res)
res
- the resourcepublic boolean embedIdentityH() throws java.io.IOException
java.io.IOException
- in case of an I/O problempublic PSResource getIdentityHCMapResource()
public PSResource getProcsetCIDInitResource()
public void includeProcsetCIDInitResource() throws java.io.IOException
java.io.IOException
- in case of an I/O problemCopyright 1999-2016 The Apache Software Foundation. All Rights Reserved.