|
fop 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.render.pcl.PCLGenerator
public class PCLGenerator
This class provides methods for generating PCL print files.
Field Summary | |
---|---|
static char |
ESC
The ESC (escape) character |
static int[] |
PCL_RESOLUTIONS
A list of all supported resolutions in PCL (values in dpi) |
Constructor Summary | |
---|---|
PCLGenerator(java.io.OutputStream out)
Main constructor. |
|
PCLGenerator(java.io.OutputStream out,
int maxResolution)
Main constructor. |
Method Summary | |
---|---|
void |
changePrintDirection(int rotate)
Changes the current print direction while maintaining the current cursor position. |
void |
clearHorizontalMargins()
Clears the horizontal margins. |
int |
convertToGray(int r,
int g,
int b)
Convert an RGB color value to a grayscale from 0 to 100. |
int |
convertToPCLShade(java.awt.Color col)
Convert a Color value to a PCL shade value (0-100). |
void |
defineGrayscalePattern(java.awt.Color col,
int patternID,
int ditherMatrixSize)
Generates a user-defined pattern for a dithering pattern matching the grayscale value of the color given. |
void |
enterHPGL2Mode(boolean restorePreviousHPGL2Cursor)
Enters the HP GL/2 mode. |
void |
enterPCLMode(boolean restorePreviousPCLCursor)
Enters the PCL mode. |
protected void |
fillRect(int w,
int h,
java.awt.Color col)
Generate a filled rectangle at the current cursor position. |
java.lang.String |
formatDouble2(double value)
Formats a double value with two decimal positions for PCL output. |
java.lang.String |
formatDouble4(double value)
Formats a double value with four decimal positions for PCL output. |
void |
formFeed()
Sends the form feed character. |
float |
getDitheringQuality()
Returns the dithering quality used when encoding gray or color images. |
int |
getMaximumBitmapResolution()
|
java.io.OutputStream |
getOutputStream()
|
java.lang.String |
getTextEncoding()
Returns the currently active text encoding. |
static boolean |
isGrayscaleImage(java.awt.image.RenderedImage img)
Indicates whether an image is a grayscale image. |
static boolean |
isJAIAvailable()
Indicates whether JAI is available. |
static boolean |
isMonochromeImage(java.awt.image.RenderedImage img)
Indicates whether an image is a monochrome (b/w) image. |
void |
paintBitmap(java.awt.image.RenderedImage img,
java.awt.Dimension targetDim,
boolean sourceTransparency)
Paint a bitmap at the current cursor position. |
void |
paintMonochromeBitmap(java.awt.image.RenderedImage img,
int resolution)
Paint a bitmap at the current cursor position. |
void |
popCursorPos()
Pops the current cursor position from the stack. |
void |
pushCursorPos()
Pushes the current cursor position on a stack (stack size: max 20 entries) |
void |
resetPrinter()
Resets the printer and restores the user default environment. |
void |
selectCurrentPattern(int patternID,
int pattern)
Select the current pattern |
void |
selectDuplexMode(int selector)
Selects the duplexing mode for the page. |
void |
selectGrayscale(java.awt.Color col)
Selects the current grayscale color (the given color is converted to grayscales). |
void |
selectOutputBin(int selector)
Selects the output bin. |
void |
selectPageSize(int selector)
Selects the page size. |
void |
selectPaperSource(int selector)
Selects the paper source. |
void |
separateJobs()
Sends the job separation command. |
void |
setCursorPos(double x,
double y)
Sets the cursor to a new absolute coordinate. |
void |
setDitheringQuality(float quality)
Sets the dithering quality used when encoding gray or color images. |
void |
setPatternTransparencyMode(boolean transparent)
Sets the pattern transparency mode. |
void |
setRasterGraphicsResolution(int value)
Sets the raster graphics resolution |
void |
setSourceTransparencyMode(boolean transparent)
Sets the source transparency mode. |
void |
setTextLength(int numberOfLines)
The Text Length command can be used to define the bottom border. |
void |
setTopMargin(int numberOfLines)
The Top Margin command designates the number of lines between the top of the logical page and the top of the text area. |
void |
setTransparencyMode(boolean source,
boolean pattern)
Sets the transparency modes. |
void |
setUnitOfMeasure(int value)
Sets the unit of measure. |
void |
setVMI(double value)
Sets the Vertical Motion Index (VMI). |
void |
universalEndOfLanguage()
Sends the universal end of language command (UEL). |
void |
writeCommand(java.lang.String cmd)
Writes a PCL escape command to the output stream. |
void |
writeText(java.lang.String s)
Writes raw text (in ISO-8859-1 encoding) to the output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char ESC
public static final int[] PCL_RESOLUTIONS
Constructor Detail |
---|
public PCLGenerator(java.io.OutputStream out)
out
- the OutputStream to write the PCL stream topublic PCLGenerator(java.io.OutputStream out, int maxResolution)
out
- the OutputStream to write the PCL stream tomaxResolution
- the maximum resolution to encode bitmap images atMethod Detail |
---|
public java.io.OutputStream getOutputStream()
public java.lang.String getTextEncoding()
public int getMaximumBitmapResolution()
public void writeCommand(java.lang.String cmd) throws java.io.IOException
cmd
- the command (without the ESCAPE character)
java.io.IOException
- In case of an I/O errorpublic void writeText(java.lang.String s) throws java.io.IOException
s
- the text
java.io.IOException
- In case of an I/O errorpublic final java.lang.String formatDouble2(double value)
value
- value to format
public final java.lang.String formatDouble4(double value)
value
- value to format
public void universalEndOfLanguage() throws java.io.IOException
java.io.IOException
- In case of an I/O errorpublic void resetPrinter() throws java.io.IOException
java.io.IOException
- In case of an I/O errorpublic void separateJobs() throws java.io.IOException
java.io.IOException
- In case of an I/O errorpublic void formFeed() throws java.io.IOException
java.io.IOException
- In case of an I/O errorpublic void setUnitOfMeasure(int value) throws java.io.IOException
value
- the resolution value (units per inch)
java.io.IOException
- In case of an I/O errorpublic void setRasterGraphicsResolution(int value) throws java.io.IOException
value
- the resolution value (units per inch)
java.io.IOException
- In case of an I/O errorpublic void selectPageSize(int selector) throws java.io.IOException
selector
- the integer representing the page size
java.io.IOException
- In case of an I/O errorpublic void selectPaperSource(int selector) throws java.io.IOException
selector
- the integer representing the paper source/tray
java.io.IOException
- In case of an I/O errorpublic void selectOutputBin(int selector) throws java.io.IOException
selector
- the integer representing the output bin
java.io.IOException
- In case of an I/O errorpublic void selectDuplexMode(int selector) throws java.io.IOException
selector
- the integer representing the duplexing mode of the page
java.io.IOException
- In case of an I/O errorpublic void clearHorizontalMargins() throws java.io.IOException
java.io.IOException
- In case of an I/O errorpublic void setTopMargin(int numberOfLines) throws java.io.IOException
numberOfLines
- the number of lines (See PCL specification for details)
java.io.IOException
- In case of an I/O errorpublic void setTextLength(int numberOfLines) throws java.io.IOException
numberOfLines
- the number of lines
java.io.IOException
- In case of an I/O errorpublic void setVMI(double value) throws java.io.IOException
value
- the VMI value
java.io.IOException
- In case of an I/O errorpublic void setCursorPos(double x, double y) throws java.io.IOException
x
- the X coordinate (in millipoints)y
- the Y coordinate (in millipoints)
java.io.IOException
- In case of an I/O errorpublic void pushCursorPos() throws java.io.IOException
java.io.IOException
- In case of an I/O errorpublic void popCursorPos() throws java.io.IOException
java.io.IOException
- In case of an I/O errorpublic void changePrintDirection(int rotate) throws java.io.IOException
rotate
- the rotation angle (counterclockwise), one of 0, 90, 180 and 270.
java.io.IOException
- In case of an I/O errorpublic void enterHPGL2Mode(boolean restorePreviousHPGL2Cursor) throws java.io.IOException
restorePreviousHPGL2Cursor
- true if the previous HP GL/2 pen position should be
restored, false if the current position is maintained
java.io.IOException
- In case of an I/O errorpublic void enterPCLMode(boolean restorePreviousPCLCursor) throws java.io.IOException
restorePreviousPCLCursor
- true if the previous PCL cursor position should be restored,
false if the current position is maintained
java.io.IOException
- In case of an I/O errorprotected void fillRect(int w, int h, java.awt.Color col) throws java.io.IOException
w
- the width in millipointsh
- the height in millipointscol
- the fill color
java.io.IOException
- In case of an I/O errorpublic void defineGrayscalePattern(java.awt.Color col, int patternID, int ditherMatrixSize) throws java.io.IOException
col
- the color to create the pattern forpatternID
- the pattern ID to useditherMatrixSize
- the size of the Bayer dither matrix to use (4 or 8 supported)
java.io.IOException
- In case of an I/O errorpublic void setSourceTransparencyMode(boolean transparent) throws java.io.IOException
transparent
- true if transparent, false for opaque
java.io.IOException
- In case of an I/O errorpublic void setPatternTransparencyMode(boolean transparent) throws java.io.IOException
transparent
- true if transparent, false for opaque
java.io.IOException
- In case of an I/O errorpublic void setTransparencyMode(boolean source, boolean pattern) throws java.io.IOException
source
- source transparency: true if transparent, false for opaquepattern
- pattern transparency: true if transparent, false for opaque
java.io.IOException
- In case of an I/O errorpublic final int convertToGray(int r, int g, int b)
r
- the red componentg
- the green componentb
- the blue component
public final int convertToPCLShade(java.awt.Color col)
col
- the color
public void selectGrayscale(java.awt.Color col) throws java.io.IOException
col
- the color
java.io.IOException
- In case of an I/O errorpublic void selectCurrentPattern(int patternID, int pattern) throws java.io.IOException
patternID
- the pattern ID (pattern
- the pattern type (java.io.IOException
- In case of an I/O errorpublic void setDitheringQuality(float quality)
quality
- a quality setting between 0.0f (worst/fastest) and 1.0f (best/slowest)public float getDitheringQuality()
public static boolean isMonochromeImage(java.awt.image.RenderedImage img)
img
- the image
public static boolean isGrayscaleImage(java.awt.image.RenderedImage img)
img
- the image
public static boolean isJAIAvailable()
public void paintBitmap(java.awt.image.RenderedImage img, java.awt.Dimension targetDim, boolean sourceTransparency) throws java.io.IOException
img
- the bitmap imagetargetDim
- the target Dimention (in mpt)sourceTransparency
- true if the background should not be erased
java.io.IOException
- In case of an I/O errorpublic void paintMonochromeBitmap(java.awt.image.RenderedImage img, int resolution) throws java.io.IOException
img
- the bitmap image (must be 1-bit b/w)resolution
- the resolution of the image (must be a PCL resolution)
java.io.IOException
- In case of an I/O error
|
fop 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |