intarsys PDF library API

de.intarsys.pdf.content.common
Class CSCreator

java.lang.Object
  extended by de.intarsys.pdf.content.CSDeviceAdapter
      extended by de.intarsys.pdf.content.CSVirtualDevice
          extended by de.intarsys.pdf.content.common.CSCreator
All Implemented Interfaces:
ICSDevice

public class CSCreator
extends CSVirtualDevice

An implementation helping to create a PDF content stream using higher level abstractions than the PDF operators.

This object deals with two abstractions:

The CSContent, a sequence of PDF operators. The CSContent can be read from an existing object like a PDPage or a PDForm or can be newly created, suing the factory methods in CSContent.

The second abstraction is the IResourcesProvider for the PDResources like Fonts, XObjects, ... that are referenced in the CSContent. The resources of the provider are not accessed until a resource relevant operation is created.

This implementation is (nearly, see AffineTransform) independent of AWT or any other window toolkit.


Field Summary
static float KAPPA
          a constant for the ease of circle creation with beziers
static int VALUE_COLOR_PRECISION
           
static int VALUE_COORDINATE_PRECISION
           
static int VALUE_DASH_PRECISION
           
static int VALUE_FACTOR_PRECISION
           
static int VALUE_FLATNESS_PRECISION
           
static int VALUE_FONT_PRECISION
           
static int VALUE_GRAY_PRECISION
           
static int VALUE_WIDTH_PRECISION
           
 
Fields inherited from class de.intarsys.pdf.content.CSDeviceAdapter
MAX_STACK_SIZE
 
Method Summary
 void close()
          Close the device after use.
 void compatibilityBegin()
          Begin a compatibility section.
 void compatibilityEnd()
          End a compatibility section.
 void copy(CSContent otherContent)
          Copy all operations from otherContent to this.
static CSCreator createFromContent(CSContent content, IResourcesProvider resourcesProvider)
          Create a CSCreator on an existing CSContent.
static CSCreator createFromProvider(IContentStreamProvider provider)
          Create a CSCreator on an existing CSContent that will be read from the IContentStreamProvider.
static CSCreator createNew(IContentStreamProvider provider)
          Create a CSCreator on a newly created CSContent.
static CSCreator createNewDetached(IResourcesProvider provider)
          Create a CSCreator on a newly created CSContent.
 void doShading(COSName name, PDShading shading)
          Paint shape and color shading according to shading dictionary.
 void doXObject(COSName name, PDXObject xObject)
          Stroke a PDXObject.
 void flush()
          Flush all pending operations on the stream.
 CSContent getContent()
          The CSContent we are working on.
 IContentStreamProvider getContentStreamProvider()
           
 IResourcesProvider getResourcesProvider()
          The IResourcesProvider associated with this.
 void inlineImage(PDImage img)
          Stroke an inlined image.
 void markedContentBegin(COSName tag)
          Begin a marked content sequence.
 void markedContentBeginProperties(COSName tag, COSName resourceName, COSDictionary properties)
          Begin a marked content sequence with a property list.
 void markedContentEnd()
          End marked content sequence started with "BMC" or "BDC".
 void markedContentPoint(COSName tag)
          Set a marked point.
 void markedContentPointProperties(COSName tag, COSName resourceName, COSDictionary properties)
          Define a marked content point with a property list.
 void open(ICSInterpreter pInterpreter)
          Open the device for use by interpreter.
 void pathClipEvenOdd()
          Intersect the current clipping path with the current path using the even/odd rule.
 void pathClipNonZero()
          Intersect the current clipping path with the current path using the nonzero winding rule.
 void pathClose()
          Close the path and append a line segment from the current coordinate to the starting point of the path.
 void pathCloseFillStrokeEvenOdd()
          Close, Fill and then stroke the path using the even/odd rule.
 void pathCloseFillStrokeNonZero()
          Close, Fill and then stroke the path using the non zero winding rule.
 void pathCloseStroke()
          Close and then stroke the path.
 void pathEnd()
          End the path without filling or stroking.
 void pathFillEvenOdd()
          Fill the path using the even/odd rule.
 void pathFillNonZero()
          Fill the path using the non-zero winding rule.
 void pathFillStrokeEvenOdd()
          Fill and then stroke the path using the even/odd rule.
 void pathFillStrokeNonZero()
          Fill and then stroke the path using the non-zero winding rule.
 void pathStroke()
          Stroke the current path.
 void penCircle(float x, float y, float r)
          Draw a circle.
 void penCurveToC(float x1, float y1, float x2, float y2, float x3, float y3)
          Append a cubic bezier curve to the path.
 void penCurveToV(float x2, float y2, float x3, float y3)
          Append a cubic bezier curve to the path.
 void penCurveToY(float x1, float y1, float x3, float y3)
          Append a cubic bezier curve to the path.
 void penEllipse(float x, float y, float rx, float ry)
          Draw an ellipse.
 void penLineTo(float x, float y)
          Add a line from the current point to x, y.
 void penMoveTo(float x, float y)
          Move the current point to x, y.
 void penRectangle(float x, float y, float w, float h)
          Append a complete rectangle to as a subpath.
 void restoreState()
          Restore the graphics state from the stack.
 void saveState()
          Save the current graphics state on a stack for later use.
 void setExtendedState(COSName name, PDExtGState gstate)
          Set the dictionary as the new graphic state, creating a new PDResources entry if needed.
 void setFlatnessTolerance(float flatness)
          Set the flatness tolerance.
 void setLineCap(int style)
          The line cap specifies the shape to be used at the ends of open subpaths.
 void setLineDash(float[] pattern, float phase)
          Define the pattern used to stroke paths.
 void setLineDash(float unitsOn, float unitsOff, float phase)
          Convenience method to access "setLineDash".
 void setLineJoin(int style)
          The line join specifies the shape to be used at the connection points of two adjacent lines in a path.
 void setLineWidth(float w)
          Set the thickness of the line used to stroke a path.
 void setMiterLimit(float miterLimit)
          The maximum ratio of MiterLength/LineWidth when connecting two lines with miter style.
 void setNonStrokeColorCMYK(float c, float m, float y, float k)
          Set the non stroking color space to /DeviceCMYK and set the color values c, m, y, K.
 void setNonStrokeColorGray(float gray)
          Set the non stroking color space to /DeviceGray and set the gray level to gray.
 void setNonStrokeColorRGB(float red, float green, float blue)
          Set the non stroking color space to /DeviceRGB and set the color values r, g, b.
 void setNonStrokeColorSpace(COSName name, PDColorSpace colorSpace)
          Set color space for non-stroking.
 void setNonStrokeColorValues(float[] values)
          Set the color used for non stroking operations, dependent on the currently selected color spaces.
 void setNonStrokeColorValues(float[] values, COSName name, PDPattern pattern)
          Set the color used for non stroking operations, dependent on the currently selected special color spaces.
 void setRenderingIntent(COSName intent)
          Set the color rendering intent.
 void setStrokeColorCMYK(float cyan, float magenta, float yellow, float key)
          Set the stroking color space to /DeviceCMYK and set the color values c, m, y, K.
 void setStrokeColorGray(float gray)
          Set the stroking color space to /DeviceGray and set the gray level to gray.
 void setStrokeColorRGB(float red, float green, float blue)
          Set the stroking color space to /DeviceRGB and set the color values r, g, b.
 void setStrokeColorSpace(COSName name, PDColorSpace colorSpace)
          Set color space for stroking.
 void setStrokeColorValues(float[] values)
          Set the color used for stroking operations, dependent on the currently selected color spaces.
 void setStrokeColorValues(float[] values, COSName name, PDPattern pattern)
          Set the color used for stroking operations, dependent on the currently selected special color spaces.
 void textBegin()
          Begin text mode.
 void textEnd()
          End text mode.
 void textLineMove(float dx, float dy)
          Move the current lext line by dx, dy.
 void textLineMoveSetLeading(float dx, float dy)
          Move the current text line by dx, dy.
 void textLineMoveTo(float x, float y)
          Move the current text line to absolute position x, y.
 void textLineNew()
          Move the current position to a new line.
 void textMove(float dx, float dy)
          Move the current text cursor by dx, dy.
 void textMoveTo(float x, float y)
          Move the current text cursor to x, y.
 void textSetCharSpacing(float charSpace)
          Set the character spacing.
 void textSetFont(COSName name, PDFont font, float size)
          Set the current font and size.
 void textSetHorizontalScaling(float scale)
          Set the horizontal scling factor.
 void textSetLeading(float leading)
          Set the text leading.
 void textSetRenderingMode(int rendering)
          Set the text rendering mode.
 void textSetRise(float rise)
          Set the text rise.
 void textSetTransform(float a, float b, float c, float d, float e, float f)
          Set the text transformation matrix.
 void textSetWordSpacing(float wordSpace)
          Set the word spacing.
 void textShow(byte[] text, int offset, int length)
          Show a sequence of bytes as text.
 void textT3SetGlyphWidth(float x, float y)
          Set the glyph width for a type 3 font.
 void textT3SetGlyphWidthBB(float x, float y, float llx, float lly, float urx, float ury)
          Set the glyph width and bounding box for a type 3 font.
 void transform(float a, float b, float c, float d, float e, float f)
          Modify the current transformation matrix by concatenating the transformations.
 
Methods inherited from class de.intarsys.pdf.content.CSDeviceAdapter
getGraphicsState, getInterpreter, textShow
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KAPPA

public static final float KAPPA
a constant for the ease of circle creation with beziers

See Also:
Constant Field Values

VALUE_COLOR_PRECISION

public static final int VALUE_COLOR_PRECISION
See Also:
Constant Field Values

VALUE_COORDINATE_PRECISION

public static final int VALUE_COORDINATE_PRECISION
See Also:
Constant Field Values

VALUE_DASH_PRECISION

public static final int VALUE_DASH_PRECISION
See Also:
Constant Field Values

VALUE_FACTOR_PRECISION

public static final int VALUE_FACTOR_PRECISION
See Also:
Constant Field Values

VALUE_FLATNESS_PRECISION

public static final int VALUE_FLATNESS_PRECISION
See Also:
Constant Field Values

VALUE_FONT_PRECISION

public static final int VALUE_FONT_PRECISION
See Also:
Constant Field Values

VALUE_GRAY_PRECISION

public static final int VALUE_GRAY_PRECISION
See Also:
Constant Field Values

VALUE_WIDTH_PRECISION

public static final int VALUE_WIDTH_PRECISION
See Also:
Constant Field Values
Method Detail

createFromContent

public static CSCreator createFromContent(CSContent content,
                                          IResourcesProvider resourcesProvider)
Create a CSCreator on an existing CSContent. The content may be read from a PDPage or a PDForm or can be completely new.

This is the most basic factory method where you have the freedom to decide where the content comes from, where the resources come frome and wher the content will be used.

Parameters:
content - The content stream to write to.
resourcesProvider - The provider for the PDResources that contain the resources referenced in the CSContent.
Returns:
The new CSCreator

createNew

public static CSCreator createNew(IContentStreamProvider provider)
Create a CSCreator on a newly created CSContent. The content is linked with the IContentStreamProvider and flushed to it when calling "flush".

Parameters:
provider - The provider whose content stream will be replaced with the result of this CSCreator
Returns:
The new CSCreator

createNewDetached

public static CSCreator createNewDetached(IResourcesProvider provider)
Create a CSCreator on a newly created CSContent. The content is not linked with the provider, which is only used the a IResourcesProvider. The resulting content can be accessed using "getContent".

Parameters:
provider - The provider for resources within the new CSContent.
Returns:
The new CSCreator

createFromProvider

public static CSCreator createFromProvider(IContentStreamProvider provider)
Create a CSCreator on an existing CSContent that will be read from the IContentStreamProvider. The old contents will be preserved, all operations are concatenated. The content is linked with the IContentStreamProvider and flushed to it when calling "flush".

Parameters:
provider - The provider whose content stream will be replaced with the result of this CSCreator
Returns:
The new CSCreator

open

public void open(ICSInterpreter pInterpreter)
Description copied from interface: ICSDevice
Open the device for use by interpreter.

Specified by:
open in interface ICSDevice
Overrides:
open in class CSVirtualDevice

compatibilityBegin

public void compatibilityBegin()
Description copied from interface: ICSDevice
Begin a compatibility section.

PDF graphics operator "BX"

Specified by:
compatibilityBegin in interface ICSDevice
Overrides:
compatibilityBegin in class CSDeviceAdapter

compatibilityEnd

public void compatibilityEnd()
Description copied from interface: ICSDevice
End a compatibility section.

PDF graphics operator "EX"

Specified by:
compatibilityEnd in interface ICSDevice
Overrides:
compatibilityEnd in class CSDeviceAdapter

copy

public void copy(CSContent otherContent)
Copy all operations from otherContent to this.

Currently no resources are copied for otherContent

Parameters:
otherContent - The source of the graphic operations.

doShading

public void doShading(COSName name,
                      PDShading shading)
Description copied from interface: ICSDevice
Paint shape and color shading according to shading dictionary.

PDF graphics operator "sh"

Specified by:
doShading in interface ICSDevice
Overrides:
doShading in class CSDeviceAdapter
Parameters:
name - The logical name of the resource in the PDResources
shading - The PDShading to be painted.

doXObject

public void doXObject(COSName name,
                      PDXObject xObject)
Description copied from interface: ICSDevice
Stroke a PDXObject. A PDXObject is a self contained graphical description, either a form, an image or a postscript program.

PDF graphics operator "Do"

Specified by:
doXObject in interface ICSDevice
Overrides:
doXObject in class CSDeviceAdapter
Parameters:
name - The logical name of the resource in the PDResources
xObject - The PDXObject to be stroked.

flush

public void flush()
Flush all pending operations on the stream.

This must be called before the getContent operation is valid.


close

public void close()
Description copied from interface: ICSDevice
Close the device after use.

Specified by:
close in interface ICSDevice
Overrides:
close in class CSDeviceAdapter

getContent

public CSContent getContent()
The CSContent we are working on. After calling flush the CSContent contains all operations stemming from calls to this.

Returns:
The CSContent we are working on.

getResourcesProvider

public IResourcesProvider getResourcesProvider()
The IResourcesProvider associated with this.

Returns:
The IResourcesProvider associated with this.

inlineImage

public void inlineImage(PDImage img)
Description copied from interface: ICSDevice
Stroke an inlined image.

PDF graphics operators "BI", "ID", "EI"

Specified by:
inlineImage in interface ICSDevice
Overrides:
inlineImage in class CSDeviceAdapter
Parameters:
img - The inlined image. The image may use some special keys instead of the standard PDImage dictionary keys.

markedContentBegin

public void markedContentBegin(COSName tag)
Description copied from interface: ICSDevice
Begin a marked content sequence.

PDF graphics operator "BMC"

Specified by:
markedContentBegin in interface ICSDevice
Overrides:
markedContentBegin in class CSDeviceAdapter
Parameters:
tag - The tag indicating the role or significance.

markedContentBeginProperties

public void markedContentBeginProperties(COSName tag,
                                         COSName resourceName,
                                         COSDictionary properties)
Description copied from interface: ICSDevice
Begin a marked content sequence with a property list.

PDF graphics operator "BDC"

Specified by:
markedContentBeginProperties in interface ICSDevice
Overrides:
markedContentBeginProperties in class CSDeviceAdapter
Parameters:
tag - The tag indicating the role or significance.
resourceName - The logical name of the resource in the PDResources
properties - The properties for the marked content sequence.

markedContentEnd

public void markedContentEnd()
Description copied from interface: ICSDevice
End marked content sequence started with "BMC" or "BDC".

PDF graphics operator "EMC"

Specified by:
markedContentEnd in interface ICSDevice
Overrides:
markedContentEnd in class CSDeviceAdapter

markedContentPoint

public void markedContentPoint(COSName tag)
Description copied from interface: ICSDevice
Set a marked point.

PDF graphics operator "MP"

Specified by:
markedContentPoint in interface ICSDevice
Overrides:
markedContentPoint in class CSDeviceAdapter
Parameters:
tag - The tag indicating the role or significance.

markedContentPointProperties

public void markedContentPointProperties(COSName tag,
                                         COSName resourceName,
                                         COSDictionary properties)
Description copied from interface: ICSDevice
Define a marked content point with a property list.

PDF graphics operator "DP"

Specified by:
markedContentPointProperties in interface ICSDevice
Overrides:
markedContentPointProperties in class CSDeviceAdapter
Parameters:
tag - The tag indicating the role or significance.
resourceName - The logical name of the resource in the PDResources
properties - The properties for the marked content point.

pathClipEvenOdd

public void pathClipEvenOdd()
Description copied from interface: ICSDevice
Intersect the current clipping path with the current path using the even/odd rule.

PDF graphics operator "W*"

Specified by:
pathClipEvenOdd in interface ICSDevice
Overrides:
pathClipEvenOdd in class CSDeviceAdapter

pathClipNonZero

public void pathClipNonZero()
Description copied from interface: ICSDevice
Intersect the current clipping path with the current path using the nonzero winding rule.

PDF graphics operator "W"

Specified by:
pathClipNonZero in interface ICSDevice
Overrides:
pathClipNonZero in class CSDeviceAdapter

pathClose

public void pathClose()
Description copied from interface: ICSDevice
Close the path and append a line segment from the current coordinate to the starting point of the path.

PDF graphics operator "h"

Specified by:
pathClose in interface ICSDevice
Overrides:
pathClose in class CSDeviceAdapter

pathCloseFillStrokeEvenOdd

public void pathCloseFillStrokeEvenOdd()
Description copied from interface: ICSDevice
Close, Fill and then stroke the path using the even/odd rule.

PDF graphics operator "b*"

Specified by:
pathCloseFillStrokeEvenOdd in interface ICSDevice
Overrides:
pathCloseFillStrokeEvenOdd in class CSDeviceAdapter

pathCloseFillStrokeNonZero

public void pathCloseFillStrokeNonZero()
Description copied from interface: ICSDevice
Close, Fill and then stroke the path using the non zero winding rule.

PDF graphics operator "b"

Specified by:
pathCloseFillStrokeNonZero in interface ICSDevice
Overrides:
pathCloseFillStrokeNonZero in class CSDeviceAdapter

pathCloseStroke

public void pathCloseStroke()
Description copied from interface: ICSDevice
Close and then stroke the path.

PDF graphics operator "s"

Specified by:
pathCloseStroke in interface ICSDevice
Overrides:
pathCloseStroke in class CSDeviceAdapter

pathEnd

public void pathEnd()
Description copied from interface: ICSDevice
End the path without filling or stroking.

This may for example be used to manipulate the clipping path without a painting operation.

PDF graphics operator "n"

Specified by:
pathEnd in interface ICSDevice
Overrides:
pathEnd in class CSDeviceAdapter

pathFillEvenOdd

public void pathFillEvenOdd()
Description copied from interface: ICSDevice
Fill the path using the even/odd rule.

PDF graphics operator "f*"

Specified by:
pathFillEvenOdd in interface ICSDevice
Overrides:
pathFillEvenOdd in class CSDeviceAdapter

pathFillNonZero

public void pathFillNonZero()
Description copied from interface: ICSDevice
Fill the path using the non-zero winding rule.

An open subpath is closed before filling.

PDF graphics operator "f"

Specified by:
pathFillNonZero in interface ICSDevice
Overrides:
pathFillNonZero in class CSDeviceAdapter

pathFillStrokeEvenOdd

public void pathFillStrokeEvenOdd()
Description copied from interface: ICSDevice
Fill and then stroke the path using the even/odd rule.

PDF graphics operator "B*"

Specified by:
pathFillStrokeEvenOdd in interface ICSDevice
Overrides:
pathFillStrokeEvenOdd in class CSDeviceAdapter

pathFillStrokeNonZero

public void pathFillStrokeNonZero()
Description copied from interface: ICSDevice
Fill and then stroke the path using the non-zero winding rule.

PDF graphics operator "B"

Specified by:
pathFillStrokeNonZero in interface ICSDevice
Overrides:
pathFillStrokeNonZero in class CSDeviceAdapter

pathStroke

public void pathStroke()
Description copied from interface: ICSDevice
Stroke the current path.

PDF graphics operator "S"

Specified by:
pathStroke in interface ICSDevice
Overrides:
pathStroke in class CSDeviceAdapter

penCircle

public void penCircle(float x,
                      float y,
                      float r)
Draw a circle. The center of the circle is at x, y in user space. r defines the radius.

Parameters:
x - The x coordinate of the center.
y - The y coordinate of the center.
r - The radius

penCurveToC

public void penCurveToC(float x1,
                        float y1,
                        float x2,
                        float y2,
                        float x3,
                        float y3)
Description copied from interface: ICSDevice
Append a cubic bezier curve to the path.
The curve extends from the current point to x3, y3, where x1,y1 and x2,y2 are the bezier control points. current +---------* x1/y1 . _ -. . *x2/y2 . . . + x3/y3

PDF graphics operator "c"

Specified by:
penCurveToC in interface ICSDevice
Overrides:
penCurveToC in class CSDeviceAdapter
Parameters:
x1 - x coordinate of first control point
y1 - y coordinate of first control point
x2 - x coordinate of second control point
y2 - y coordinate of second control point
x3 - x coordinate of endpoint
y3 - y coordinate of endpoint

penCurveToV

public void penCurveToV(float x2,
                        float y2,
                        float x3,
                        float y3)
Description copied from interface: ICSDevice
Append a cubic bezier curve to the path. The curve extends from the current point to x3, y3, where the first control point coincides with the current point and x2,y2 is the second bezier control point. current + . _ -. . *x2/y2 . . . + x3/y3

PDF graphics operator "v"

Specified by:
penCurveToV in interface ICSDevice
Overrides:
penCurveToV in class CSDeviceAdapter
Parameters:
x2 - x coordinate of second control point
y2 - y coordinate of second control point
x3 - x coordinate of endpoint
y3 - y coordinate of endpoint

penCurveToY

public void penCurveToY(float x1,
                        float y1,
                        float x3,
                        float y3)
Description copied from interface: ICSDevice
Append a cubic bezier curve to the path.

The curve extends from the current point to x3, y3, where x1,y1 and x3,y3 are the bezier control points. current +---------* x1/y1 . _ -. . . . . + x3/y3

PDF graphics operator "y"

Specified by:
penCurveToY in interface ICSDevice
Overrides:
penCurveToY in class CSDeviceAdapter
Parameters:
x1 - x coordinate of first control point
y1 - y coordinate of first control point
x3 - x coordinate of endpoint
y3 - y coordinate of endpoint

penEllipse

public void penEllipse(float x,
                       float y,
                       float rx,
                       float ry)
Draw an ellipse. The center of the ellipse is at x, y in user space. rx and ry define the radius in x and y direction respectively.

Parameters:
x - The x coordinate of the center.
y - The y coordinate of the center.
rx - The radius in x direction
ry - The radius in y direction

penLineTo

public void penLineTo(float x,
                      float y)
Description copied from interface: ICSDevice
Add a line from the current point to x, y. The new current point is x, y.

PDF graphics operator "l"

Specified by:
penLineTo in interface ICSDevice
Overrides:
penLineTo in class CSDeviceAdapter
Parameters:
x - The new current x coordinate
y - The new current y coordinate

penMoveTo

public void penMoveTo(float x,
                      float y)
Description copied from interface: ICSDevice
Move the current point to x, y. No line is added to the path, a new subpath is started.

PDF graphics operator "m"

Specified by:
penMoveTo in interface ICSDevice
Overrides:
penMoveTo in class CSDeviceAdapter
Parameters:
x - The new current x coordinate
y - The new current y coordinate

penRectangle

public void penRectangle(float x,
                         float y,
                         float w,
                         float h)
Description copied from interface: ICSDevice
Append a complete rectangle to as a subpath.

The lower left corner is at x, y, the dimensions are width and height. The numbers are defined in user space.

PDF graphics operator "re"

Specified by:
penRectangle in interface ICSDevice
Overrides:
penRectangle in class CSDeviceAdapter
Parameters:
x - The x coordinate of the lower left corner in user space
y - The y coordinate of the lower left corner in user space
w - The width in user space
h - The height in user space

restoreState

public void restoreState()
Description copied from interface: ICSDevice
Restore the graphics state from the stack.

PDF graphics operator "Q"

Specified by:
restoreState in interface ICSDevice
Overrides:
restoreState in class CSDeviceAdapter

saveState

public void saveState()
Description copied from interface: ICSDevice
Save the current graphics state on a stack for later use.

PDF graphics operator "q"

Specified by:
saveState in interface ICSDevice
Overrides:
saveState in class CSDeviceAdapter

setLineDash

public void setLineDash(float unitsOn,
                        float unitsOff,
                        float phase)
Convenience method to access "setLineDash".

Parameters:
unitsOn -
unitsOff -
phase -

setExtendedState

public void setExtendedState(COSName name,
                             PDExtGState gstate)
Description copied from interface: ICSDevice
Set the dictionary as the new graphic state, creating a new PDResources entry if needed.

PDF graphics operator "gs"

Specified by:
setExtendedState in interface ICSDevice
Overrides:
setExtendedState in class CSDeviceAdapter
Parameters:
name - The logical name of the resource in the PDResources
gstate - The new PDExtGState

setFlatnessTolerance

public void setFlatnessTolerance(float flatness)
Description copied from interface: ICSDevice
Set the flatness tolerance. flatness is a value between 0 and 100, with 0 defining the device's default flatness tolerance.

PDF graphics operator "i"

Specified by:
setFlatnessTolerance in interface ICSDevice
Overrides:
setFlatnessTolerance in class CSDeviceAdapter
Parameters:
flatness - The flatness tolerance between 0 and 100.

setLineCap

public void setLineCap(int style)
Description copied from interface: ICSDevice
The line cap specifies the shape to be used at the ends of open subpaths. 0: Butt. The stroke is cut at the endpoint. 1: Round. A circle is drawn with the diamter of the line width at the endpoint 2: Square. A square is drawn with its center at the endpoint.

PDF graphics operator "J"

Specified by:
setLineCap in interface ICSDevice
Overrides:
setLineCap in class CSDeviceAdapter
Parameters:
style - The line cap style to use (0,1 or 2)

setLineDash

public void setLineDash(float[] pattern,
                        float phase)
Description copied from interface: ICSDevice
Define the pattern used to stroke paths. unitsOn defines a length in user space where the line is drawn, unitsOff defines a length in user space wher the line is not drawn. phase defines a "offset" in the pattern definition.

This is a simplified version that only allows for a two phase pattern.

PDF graphics operator "d"

Specified by:
setLineDash in interface ICSDevice
Overrides:
setLineDash in class CSDeviceAdapter
Parameters:
pattern - The pattern array for the dash
phase - Offset in pattern

setLineJoin

public void setLineJoin(int style)
Description copied from interface: ICSDevice
The line join specifies the shape to be used at the connection points of two adjacent lines in a path. 0: Miter Join, the outer line boreders are extended until they meet. 1: Round join. A circle is drawn at the meeting point with its diameter the same as the line width. 2: Bevel join. The segments are cut at the endpoints as in the line cap style "Butt". The empty triangle is filled.

PDF graphics operator "j"

Specified by:
setLineJoin in interface ICSDevice
Overrides:
setLineJoin in class CSDeviceAdapter
Parameters:
style - The line join style to use (one of 0,1,2)

setLineWidth

public void setLineWidth(float w)
Description copied from interface: ICSDevice
Set the thickness of the line used to stroke a path. This is a number in user space units.

A width of zero denotes the thinest line that can be rendered.

PDF graphics operator "w"

Specified by:
setLineWidth in interface ICSDevice
Overrides:
setLineWidth in class CSDeviceAdapter
Parameters:
w - The line width in user space.

setMiterLimit

public void setMiterLimit(float miterLimit)
Description copied from interface: ICSDevice
The maximum ratio of MiterLength/LineWidth when connecting two lines with miter style.

PDF graphics operator "M"

Specified by:
setMiterLimit in interface ICSDevice
Overrides:
setMiterLimit in class CSDeviceAdapter
Parameters:
miterLimit - The maximum ratio of MiterLength/LineWidth when connecting two lines with miter style.

setNonStrokeColorCMYK

public void setNonStrokeColorCMYK(float c,
                                  float m,
                                  float y,
                                  float k)
Description copied from interface: ICSDevice
Set the non stroking color space to /DeviceCMYK and set the color values c, m, y, K.

Specified by:
setNonStrokeColorCMYK in interface ICSDevice
Overrides:
setNonStrokeColorCMYK in class CSDeviceAdapter
Parameters:
c - A number between 0 (minimum) and 1 (maximum)
m - A number between 0 (minimum) and 1 (maximum)
y - A number between 0 (minimum) and 1 (maximum)
k - A number between 0 (minimum) and 1 (maximum)

setNonStrokeColorGray

public void setNonStrokeColorGray(float gray)
Description copied from interface: ICSDevice
Set the non stroking color space to /DeviceGray and set the gray level to gray.

Specified by:
setNonStrokeColorGray in interface ICSDevice
Overrides:
setNonStrokeColorGray in class CSDeviceAdapter
Parameters:
gray - A number between 0 (black) and 1 (white)

setNonStrokeColorRGB

public void setNonStrokeColorRGB(float red,
                                 float green,
                                 float blue)
Description copied from interface: ICSDevice
Set the non stroking color space to /DeviceRGB and set the color values r, g, b.

Specified by:
setNonStrokeColorRGB in interface ICSDevice
Overrides:
setNonStrokeColorRGB in class CSDeviceAdapter
Parameters:
red - A number between 0 (minimum) and 1 (maximum)
green - A number between 0 (minimum) and 1 (maximum)
blue - A number between 0 (minimum) and 1 (maximum)

setNonStrokeColorSpace

public void setNonStrokeColorSpace(COSName name,
                                   PDColorSpace colorSpace)
Description copied from interface: ICSDevice
Set color space for non-stroking.

PDF graphics operator "cs"

Specified by:
setNonStrokeColorSpace in interface ICSDevice
Overrides:
setNonStrokeColorSpace in class CSDeviceAdapter
Parameters:
name - The logical name of the resource in the PDResources
colorSpace - The new PDColorSpace

setNonStrokeColorValues

public void setNonStrokeColorValues(float[] values)
Description copied from interface: ICSDevice
Set the color used for non stroking operations, dependent on the currently selected color spaces.

PDF graphics operator "sc" or "scn", dependen on the active color space.

Specified by:
setNonStrokeColorValues in interface ICSDevice
Overrides:
setNonStrokeColorValues in class CSDeviceAdapter
Parameters:
values - The color values

setNonStrokeColorValues

public void setNonStrokeColorValues(float[] values,
                                    COSName name,
                                    PDPattern pattern)
Description copied from interface: ICSDevice
Set the color used for non stroking operations, dependent on the currently selected special color spaces.

PDF graphics operator "scn"

Specified by:
setNonStrokeColorValues in interface ICSDevice
Overrides:
setNonStrokeColorValues in class CSDeviceAdapter
Parameters:
values - The color values.
name - An optional logical name of the resource in the PDResources
pattern - An optional PDPattern

setRenderingIntent

public void setRenderingIntent(COSName intent)
Description copied from interface: ICSDevice
Set the color rendering intent.

PDF graphics operator "ri"

Specified by:
setRenderingIntent in interface ICSDevice
Overrides:
setRenderingIntent in class CSDeviceAdapter
Parameters:
intent - The name of the rendering intent.

setStrokeColorCMYK

public void setStrokeColorCMYK(float cyan,
                               float magenta,
                               float yellow,
                               float key)
Description copied from interface: ICSDevice
Set the stroking color space to /DeviceCMYK and set the color values c, m, y, K.

Specified by:
setStrokeColorCMYK in interface ICSDevice
Overrides:
setStrokeColorCMYK in class CSDeviceAdapter
Parameters:
cyan - A number between 0 (minimum) and 1 (maximum)
magenta - A number between 0 (minimum) and 1 (maximum)
yellow - A number between 0 (minimum) and 1 (maximum)
key - A number between 0 (minimum) and 1 (maximum)

setStrokeColorGray

public void setStrokeColorGray(float gray)
Description copied from interface: ICSDevice
Set the stroking color space to /DeviceGray and set the gray level to gray.

Specified by:
setStrokeColorGray in interface ICSDevice
Overrides:
setStrokeColorGray in class CSDeviceAdapter
Parameters:
gray - A number between 0 (black) and 1 (white)

setStrokeColorRGB

public void setStrokeColorRGB(float red,
                              float green,
                              float blue)
Description copied from interface: ICSDevice
Set the stroking color space to /DeviceRGB and set the color values r, g, b.

Specified by:
setStrokeColorRGB in interface ICSDevice
Overrides:
setStrokeColorRGB in class CSDeviceAdapter
Parameters:
red - A number between 0 (minimum) and 1 (maximum)
green - A number between 0 (minimum) and 1 (maximum)
blue - A number between 0 (minimum) and 1 (maximum)

setStrokeColorSpace

public void setStrokeColorSpace(COSName name,
                                PDColorSpace colorSpace)
Description copied from interface: ICSDevice
Set color space for stroking.

PDF graphics operator "CS"

Specified by:
setStrokeColorSpace in interface ICSDevice
Overrides:
setStrokeColorSpace in class CSDeviceAdapter
Parameters:
name - The logical name of the resource in the PDResources
colorSpace - The new PDColorSpace

setStrokeColorValues

public void setStrokeColorValues(float[] values)
Description copied from interface: ICSDevice
Set the color used for stroking operations, dependent on the currently selected color spaces.

PDF graphics operator "SC" or "SCN", dependen on the active color space.

Specified by:
setStrokeColorValues in interface ICSDevice
Overrides:
setStrokeColorValues in class CSDeviceAdapter
Parameters:
values - The color values.

setStrokeColorValues

public void setStrokeColorValues(float[] values,
                                 COSName name,
                                 PDPattern pattern)
Description copied from interface: ICSDevice
Set the color used for stroking operations, dependent on the currently selected special color spaces.

PDF graphics operator "SCN"

Specified by:
setStrokeColorValues in interface ICSDevice
Overrides:
setStrokeColorValues in class CSDeviceAdapter
Parameters:
values - The color values.
name - An optional logical name of the resource in the PDResources
pattern - An optional PDPattern

textMoveTo

public void textMoveTo(float x,
                       float y)
Description copied from interface: ICSDevice
Move the current text cursor to x, y.

There is no graphics operator for this. It is implemented as a tool for the ease of creating a content stream.

Specified by:
textMoveTo in interface ICSDevice
Overrides:
textMoveTo in class CSDeviceAdapter
Parameters:
x - The x coordinate for the next glyph starting point .
y - The y coordinate for the next glyph starting point .

textMove

public void textMove(float dx,
                     float dy)
Description copied from interface: ICSDevice
Move the current text cursor by dx, dy.

There is no graphics operator for this. It is implemented as a tool for the ease of creating a content stream.

Specified by:
textMove in interface ICSDevice
Overrides:
textMove in class CSDeviceAdapter
Parameters:
dx - The x offset for the new glyph starting point from the current text cursor position.
dy - The x offset for the new glyph starting point from the current text cursor position.

textShow

public void textShow(byte[] text,
                     int offset,
                     int length)
Description copied from interface: ICSDevice
Show a sequence of bytes as text.

PDF graphics operator "Tj"

Specified by:
textShow in interface ICSDevice
Overrides:
textShow in class CSDeviceAdapter
Parameters:
text - The bytes to be shown.

textBegin

public void textBegin()
Description copied from interface: ICSDevice
Begin text mode.

PDF graphics operator "BT"

Specified by:
textBegin in interface ICSDevice
Overrides:
textBegin in class CSDeviceAdapter

textEnd

public void textEnd()
Description copied from interface: ICSDevice
End text mode.

PDF graphics operator "ET"

Specified by:
textEnd in interface ICSDevice
Overrides:
textEnd in class CSDeviceAdapter

textLineMove

public void textLineMove(float dx,
                         float dy)
Description copied from interface: ICSDevice
Move the current lext line by dx, dy.

PDF graphics operator "Td"

Specified by:
textLineMove in interface ICSDevice
Overrides:
textLineMove in class CSDeviceAdapter
Parameters:
dx - The x offset for the new glyph starting point from the last text line starting point.
dy - The y offset for the new glyph starting point from the last text line starting point.

textLineMoveSetLeading

public void textLineMoveSetLeading(float dx,
                                   float dy)
Move the current text line by dx, dy. Set the current leading to the dy offset.

PDF graphics operator "TD"

Parameters:
dx - The x offset for the new glyph starting point.
dy - The y offset for the new glyph starting point.

textLineMoveTo

public void textLineMoveTo(float x,
                           float y)
Move the current text line to absolute position x, y.

PDF graphics operator "Td"


textLineNew

public void textLineNew()
Description copied from interface: ICSDevice
Move the current position to a new line. y.

PDF graphics operator "T*"

Specified by:
textLineNew in interface ICSDevice
Overrides:
textLineNew in class CSDeviceAdapter

textSetCharSpacing

public void textSetCharSpacing(float charSpace)
Description copied from interface: ICSDevice
Set the character spacing.

PDF graphics operator "Tc"

Specified by:
textSetCharSpacing in interface ICSDevice
Overrides:
textSetCharSpacing in class CSDeviceAdapter
Parameters:
charSpace - The character spacing

textSetFont

public void textSetFont(COSName name,
                        PDFont font,
                        float size)
Description copied from interface: ICSDevice
Set the current font and size.

PDF graphics operator "Tf"

Specified by:
textSetFont in interface ICSDevice
Overrides:
textSetFont in class CSDeviceAdapter
Parameters:
name - The logical name of the resource in the PDResources
font - The new PDFont
size - The new font size (scaling)

textSetHorizontalScaling

public void textSetHorizontalScaling(float scale)
Description copied from interface: ICSDevice
Set the horizontal scling factor.

PDF graphics operator "Tz"

Specified by:
textSetHorizontalScaling in interface ICSDevice
Overrides:
textSetHorizontalScaling in class CSDeviceAdapter
Parameters:
scale - The new horizontal scaling factor.

textSetLeading

public void textSetLeading(float leading)
Description copied from interface: ICSDevice
Set the text leading.

PDF graphics operator "TL"

Specified by:
textSetLeading in interface ICSDevice
Overrides:
textSetLeading in class CSDeviceAdapter
Parameters:
leading - The new leading

textSetRenderingMode

public void textSetRenderingMode(int rendering)
Description copied from interface: ICSDevice
Set the text rendering mode.

PDF graphics operator "Tr"

Specified by:
textSetRenderingMode in interface ICSDevice
Overrides:
textSetRenderingMode in class CSDeviceAdapter
Parameters:
rendering - The new rendering mode.

textSetRise

public void textSetRise(float rise)
Description copied from interface: ICSDevice
Set the text rise.

PDF graphics operator "Ts"

Specified by:
textSetRise in interface ICSDevice
Overrides:
textSetRise in class CSDeviceAdapter
Parameters:
rise - The new text rise (super/subscript) amount

textSetTransform

public void textSetTransform(float a,
                             float b,
                             float c,
                             float d,
                             float e,
                             float f)
Description copied from interface: ICSDevice
Set the text transformation matrix. Both the text matrix anf the text line matrix are set to the new values.

PDF graphics operator "Tm"

Specified by:
textSetTransform in interface ICSDevice
Overrides:
textSetTransform in class CSDeviceAdapter
Parameters:
a - operand 1,1 in the matrix
b - operand 1,2 in the matrix
c - operand 2,1 in the matrix
d - operand 2,2 in the matrix
e - operand 3,1 in the matrix
f - operand 3,2 in the matrix

textSetWordSpacing

public void textSetWordSpacing(float wordSpace)
Description copied from interface: ICSDevice
Set the word spacing.

PDF graphics operator "Tw"

Specified by:
textSetWordSpacing in interface ICSDevice
Overrides:
textSetWordSpacing in class CSDeviceAdapter
Parameters:
wordSpace - The new word spacing.

textT3SetGlyphWidth

public void textT3SetGlyphWidth(float x,
                                float y)
Description copied from interface: ICSDevice
Set the glyph width for a type 3 font.

PDF graphics operator "d0"

Specified by:
textT3SetGlyphWidth in interface ICSDevice
Overrides:
textT3SetGlyphWidth in class CSDeviceAdapter
Parameters:
x - The glyph width
y - must be 0

textT3SetGlyphWidthBB

public void textT3SetGlyphWidthBB(float x,
                                  float y,
                                  float llx,
                                  float lly,
                                  float urx,
                                  float ury)
Description copied from interface: ICSDevice
Set the glyph width and bounding box for a type 3 font.

PDF graphics operator "d1"

Specified by:
textT3SetGlyphWidthBB in interface ICSDevice
Overrides:
textT3SetGlyphWidthBB in class CSDeviceAdapter
Parameters:
x - The glyph width.
y - must be 0
llx - lower left x of bounding box
lly - lower left y of bounding box
urx - upper right x of bounding box
ury - upper right y of bounding box

transform

public void transform(float a,
                      float b,
                      float c,
                      float d,
                      float e,
                      float f)
Description copied from interface: ICSDevice
Modify the current transformation matrix by concatenating the transformations.

PDF graphics operator "cm"

Specified by:
transform in interface ICSDevice
Overrides:
transform in class CSDeviceAdapter
Parameters:
a - operand 1,1 in the matrix
b - operand 1,2 in the matrix
c - operand 2,1 in the matrix
d - operand 2,2 in the matrix
e - operand 3,1 in the matrix
f - operand 3,2 in the matrix

getContentStreamProvider

public IContentStreamProvider getContentStreamProvider()

intarsys PDF library API

Copyright © 2006 intarsys consulting GmbH. All Rights Reserved.