public class PdfCanvas extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected PdfStream |
contentStream
the content stream for this canvas object.
|
protected CanvasGraphicsState |
currentGs
the current graphics state.
|
protected PdfDocument |
document
the document that the resulting content stream of this canvas will be written to.
|
protected Stack<CanvasGraphicsState> |
gsStack
a LIFO stack of graphics state saved states.
|
protected List<Integer> |
layerDepth
The list where we save/restore the layer depth.
|
protected int |
mcDepth
a counter variable for the marked content stack.
|
protected PdfResources |
resources
the resources for the page that this canvas belongs to.
|
Constructor and Description |
---|
PdfCanvas(PdfDocument doc, int pageNum)
Convenience method for fast PdfCanvas creation by a certain page.
|
PdfCanvas(PdfFormXObject xObj, PdfDocument document)
Creates a PdfCanvas from a PdfFormXObject.
|
PdfCanvas(PdfPage page)
Convenience method for fast PdfCanvas creation by a certain page.
|
PdfCanvas(PdfPage page, boolean wrapOldContent)
Convenience method for fast PdfCanvas creation by a certain page.
|
PdfCanvas(PdfStream contentStream, PdfResources resources, PdfDocument document)
Creates PdfCanvas from content stream of page, form XObject, pattern etc.
|
Modifier and Type | Method and Description |
---|---|
PdfXObject |
addImage(ImageData image, float x, float y, boolean asInline)
Creates Image XObject from image and adds it to canvas.
|
PdfXObject |
addImage(ImageData image, float x, float y, float width, boolean asInline)
Creates Image XObject from image and adds it to the specified position with specified width preserving aspect ratio.
|
PdfXObject |
addImage(ImageData image, float x, float y, float height, boolean asInline, boolean dummy)
Creates Image XObject from image and adds it to the specified position with specified width preserving aspect ratio.
|
PdfXObject |
addImage(ImageData image, float a, float b, float c, float d, float e, float f)
Creates Image XObject from image and adds it to canvas (as Image XObject).
|
PdfXObject |
addImage(ImageData image, float a, float b, float c, float d, float e, float f, boolean asInline)
Creates Image XObject from image and adds it to canvas.
|
PdfXObject |
addImage(ImageData image, Rectangle rect, boolean asInline)
Creates Image XObject from image and adds it to canvas.
|
protected void |
addInlineImage(PdfImageXObject imageXObject, float a, float b, float c, float d, float e, float f)
Adds PdfImageXObject to canvas.
|
PdfCanvas |
addXObject(PdfXObject xObject, float x, float y)
Adds PdfXObject to the specified position.
|
PdfCanvas |
addXObject(PdfXObject xObject, float x, float y, float width)
Adds PdfXObject to the specified position with specified width preserving aspect ratio.
|
PdfCanvas |
addXObject(PdfXObject xObject, float x, float y, float height, boolean dummy)
Adds PdfXObject to the specified position with specified height preserving aspect ratio.
|
PdfCanvas |
addXObject(PdfXObject xObject, float a, float b, float c, float d, float e, float f)
Adds PdfXObject to canvas.
|
PdfCanvas |
addXObject(PdfXObject xObject, Rectangle rect)
Adds PdfXObject to specified rectangle on canvas.
|
PdfCanvas |
arc(double x1, double y1, double x2, double y2, double startAng, double extent)
Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2, starting at startAng degrees and covering extent degrees.
|
void |
attachContentStream(PdfStream contentStream)
Attaches new content stream to the canvas.
|
PdfCanvas |
beginLayer(IPdfOCG layer)
Begins a graphic block whose visibility is controlled by the layer .
|
PdfCanvas |
beginMarkedContent(PdfName tag)
Manually start a Marked Content sequence.
|
PdfCanvas |
beginMarkedContent(PdfName tag, PdfDictionary properties)
Manually start a Marked Content sequence with properties.
|
PdfCanvas |
beginText()
Begins text block (PDF BT operator).
|
PdfCanvas |
beginVariableText()
Begins variable text block
|
static List |
bezierArc(double x1, double y1, double x2, double y2, double startAng, double extent)
Generates an array of bezier curves to draw an arc.
|
PdfCanvas |
circle(double x, double y, double r)
Draws a circle.
|
PdfCanvas |
clip()
Modify the current clipping path by intersecting it with the current path, using the nonzero winding rule to determine which regions lie inside the clipping path.
|
PdfCanvas |
closePath()
Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath.
|
PdfCanvas |
closePathEoFillStroke()
Closes the path, fills it using the even-odd rule to determine the region to fill and strokes it.
|
PdfCanvas |
closePathFillStroke()
Closes the path, fills it using the non-zero winding number rule to determine the region to fill and strokes it.
|
PdfCanvas |
closePathStroke()
Closes the path and strokes it.
|
PdfCanvas |
closeTag()
Manually close a tag, ending a Marked Content sequence.
|
PdfCanvas |
concatMatrix(AffineTransform transform)
Concatenates the affine transformation matrix to the current matrix in the content stream managed by this Canvas.
|
PdfCanvas |
concatMatrix(double a, double b, double c, double d, double e, double f)
Concatenates the 2x3 affine transformation matrix to the current matrix in the content stream managed by this Canvas.
|
PdfCanvas |
concatMatrix(PdfArray array)
Concatenates the 2x3 affine transformation matrix to the current matrix in the content stream managed by this Canvas.
|
PdfCanvas |
curveFromTo(double x1, double y1, double x3, double y3)
Appends a Bezier curve to the path, starting from the current point.
|
PdfCanvas |
curveTo(double x2, double y2, double x3, double y3)
Appends a Bezier curve to the path, starting from the current point.
|
PdfCanvas |
curveTo(double x1, double y1, double x2, double y2, double x3, double y3)
Appends a Bêzier curve to the path, starting from the current point.
|
PdfCanvas |
ellipse(double x1, double y1, double x2, double y2)
Draws an ellipse inscribed within the rectangle x1,y1,x2,y2.
|
PdfCanvas |
endLayer()
Ends OCG layer.
|
PdfCanvas |
endMarkedContent()
Manually end a Marked Content sequence.
|
PdfCanvas |
endText()
Ends text block (PDF ET operator).
|
PdfCanvas |
endVariableText()
Ends variable text block
|
PdfCanvas |
eoClip()
Modify the current clipping path by intersecting it with the current path, using the even-odd rule to determine which regions lie inside the clipping path.
|
PdfCanvas |
eoFill()
EOFills current path.
|
PdfCanvas |
eoFillStroke()
Fills the path, using the even-odd rule to determine the region to fill and strokes it.
|
PdfCanvas |
fill()
Fills current path.
|
PdfCanvas |
fillStroke()
Fills the path using the non-zero winding number rule to determine the region to fill and strokes it.
|
PdfStream |
getContentStream()
Please, use this method with caution and only if you know what you are doing.
|
CanvasGraphicsState |
getGraphicsState()
Gets current CanvasGraphicsState .
|
PdfResources |
getResources()
Get the resources of the page that this canvas belongs to..
|
PdfCanvas |
lineTo(double x, double y)
Appends a straight line segment from the current point (x, y).
|
PdfCanvas |
moveText(double x, double y)
Moves text by shifting text line matrix (PDF Td operator).
|
PdfCanvas |
moveTextWithLeading(float x, float y)
Moves to the start of the next line, offset from the start of the current line.
|
PdfCanvas |
moveTo(double x, double y)
Move the current point (x, y), omitting any connecting line segment.
|
PdfCanvas |
newlineShowText(float wordSpacing, float charSpacing, String text)
Moves to the next line and shows text string, using the given values of the character and word spacing parameters.
|
PdfCanvas |
newlineShowText(String text)
Moves to the next line and shows text .
|
PdfCanvas |
newlineText()
Moves to the start of the next line.
|
PdfCanvas |
newPath()
Ends the path without filling or stroking it.
|
PdfCanvas |
openTag(CanvasTag tag)
Manually open a canvas tag, beginning a Marked Content sequence.
|
PdfCanvas |
openTag(TagReference tagReference)
Open a tag, beginning a Marked Content sequence.
|
PdfCanvas |
paintShading(PdfShading shading)
Paints a shading object and adds it to the resources of this canvas
|
PdfCanvas |
rectangle(double x, double y, double width, double height)
Draws a rectangle.
|
PdfCanvas |
rectangle(Rectangle rectangle)
Draws a rectangle.
|
void |
release()
Releases the canvas.
|
PdfCanvas |
resetFillColorCmyk()
Changes the current color for filling paths to black.
|
PdfCanvas |
resetFillColorGray()
Changes the current color for filling paths to black.
|
PdfCanvas |
resetFillColorRgb()
Changes the current color for filling paths to black.
|
PdfCanvas |
resetStrokeColorCmyk()
Changes the current color for stroking paths to black.
|
PdfCanvas |
resetStrokeColorGray()
Changes the current color for stroking paths to black.
|
PdfCanvas |
resetStrokeColorRgb()
Changes the current color for stroking paths to black.
|
PdfCanvas |
restoreState()
Restores graphics state.
|
PdfCanvas |
roundRectangle(double x, double y, double width, double height, double radius)
Draws rounded rectangle.
|
PdfCanvas |
saveState()
Saves graphics state.
|
PdfCanvas |
setCharacterSpacing(float charSpacing)
Sets the character spacing parameter.
|
PdfCanvas |
setColor(Color color, boolean fill)
Changes the current color for paths.
|
PdfCanvas |
setColor(PdfColorSpace colorSpace, float[] colorValue, boolean fill)
Changes the current color for paths.
|
PdfCanvas |
setColor(PdfColorSpace colorSpace, float[] colorValue, PdfPattern pattern, boolean fill)
Changes the current color for paths with an explicitly defined pattern.
|
PdfExtGState |
setExtGState(PdfDictionary extGState)
Sets the ExtGState dictionary for the current graphics state
|
PdfCanvas |
setExtGState(PdfExtGState extGState)
Sets the ExtGState dictionary for the current graphics state
|
PdfCanvas |
setFillColor(Color color)
Changes the current color for filling paths.
|
PdfCanvas |
setFillColorCmyk(float c, float m, float y, float k)
Changes the current color for filling paths to a CMYK value.
|
PdfCanvas |
setFillColorGray(float g)
Changes the current color for filling paths to a grayscale value.
|
PdfCanvas |
setFillColorRgb(float r, float g, float b)
Changes the current color for filling paths to an RGB value.
|
PdfCanvas |
setFillColorShading(PdfPattern.Shading shading)
Adds or changes the shading of the current fill color path.
|
PdfCanvas |
setFlatnessTolerance(float flatnessTolerance)
Changes the Flatness.
|
PdfCanvas |
setFontAndSize(PdfFont font, float size)
Sets font and size (PDF Tf operator).
|
PdfCanvas |
setHorizontalScaling(float scale)
Sets the horizontal scaling parameter.
|
PdfCanvas |
setLeading(float leading)
Sets the text leading parameter.
|
PdfCanvas |
setLineCapStyle(int lineCapStyle)
Sets the line cap style, the shape to be used at the ends of open subpaths when they are stroked.
|
PdfCanvas |
setLineDash(float phase)
Changes the value of the line dash pattern.
|
PdfCanvas |
setLineDash(float[] array, float phase)
Changes the value of the line dash pattern.
|
PdfCanvas |
setLineDash(float unitsOn, float phase)
Changes the value of the line dash pattern.
|
PdfCanvas |
setLineDash(float unitsOn, float unitsOff, float phase)
Changes the value of the line dash pattern.
|
PdfCanvas |
setLineJoinStyle(int lineJoinStyle)
Sets the line join style, the shape to be used at the corners of paths when they are stroked.
|
PdfCanvas |
setLineWidth(float lineWidth)
Sets line width.
|
PdfCanvas |
setMiterLimit(float miterLimit)
Sets the miter limit, a parameter specifying the maximum length a miter join may extend beyond the join point, relative to the angle of the line segments.
|
PdfCanvas |
setRenderingIntent(PdfName renderingIntent)
Set the rendering intent.
|
PdfCanvas |
setStrokeColor(Color color)
Changes the current color for stroking paths.
|
PdfCanvas |
setStrokeColorCmyk(float c, float m, float y, float k)
Changes the current color for stroking paths to a CMYK value.
|
PdfCanvas |
setStrokeColorGray(float g)
Changes the current color for stroking paths to a grayscale value.
|
PdfCanvas |
setStrokeColorRgb(float r, float g, float b)
Changes the current color for stroking paths to an RGB value.
|
PdfCanvas |
setStrokeColorShading(PdfPattern.Shading shading)
Adds or changes the shading of the current stroke color path.
|
PdfCanvas |
setTextMatrix(AffineTransform transform)
Replaces the text matrix.
|
PdfCanvas |
setTextMatrix(float x, float y)
Changes the text matrix.
|
PdfCanvas |
setTextMatrix(float a, float b, float c, float d, float x, float y)
Replaces the text matrix.
|
PdfCanvas |
setTextRenderingMode(int textRenderingMode)
Sets text rendering mode.
|
PdfCanvas |
setTextRise(float textRise)
Sets the text rise parameter.
|
PdfCanvas |
setWordSpacing(float wordSpacing)
Sets the word spacing parameter.
|
PdfCanvas |
showText(GlyphLine text)
Shows text (operator Tj).
|
PdfCanvas |
showText(GlyphLine text, Iterator<GlyphLine.GlyphLinePart> iterator)
Shows text (operator Tj).
|
PdfCanvas |
showText(PdfArray textArray)
Shows text (operator TJ)
|
PdfCanvas |
showText(String text)
Shows text (operator Tj).
|
PdfCanvas |
stroke()
Strokes the path.
|
PdfCanvas |
writeLiteral(char c)
Outputs a char directly to the content.
|
PdfCanvas |
writeLiteral(float n)
Outputs a float directly to the content.
|
PdfCanvas |
writeLiteral(String s)
Outputs a String directly to the content.
|
protected Stack<CanvasGraphicsState> gsStack
protected CanvasGraphicsState currentGs
protected PdfStream contentStream
protected PdfResources resources
PdfResources
protected PdfDocument document
protected int mcDepth
public PdfCanvas(PdfStream contentStream, PdfResources resources, PdfDocument document)
contentStream
- The content stream
resources
- The resources, a specialized dictionary that can be used by PDF instructions in the content stream
document
- The document that the resulting content stream will be written to
public PdfCanvas(PdfPage page)
page
- page to create canvas from.
public PdfCanvas(PdfPage page, boolean wrapOldContent)
page
- page to create canvas from.
wrapOldContent
- true to wrap all old content streams into q/Q operators so that the state of old content streams would not affect the new one
public PdfCanvas(PdfFormXObject xObj, PdfDocument document)
xObj
- the PdfFormXObject used to create the PdfCanvas
document
- the document to which the resulting content stream will be written
public PdfCanvas(PdfDocument doc, int pageNum)
doc
- The document
pageNum
- The page number
public PdfResources getResources()
public void attachContentStream(PdfStream contentStream)
contentStream
- a content stream to attach.
public CanvasGraphicsState getGraphicsState()
CanvasGraphicsState
.
public void release()
public PdfCanvas saveState()
public PdfCanvas restoreState()
public PdfCanvas concatMatrix(double a, double b, double c, double d, double e, double f)
setTextMatrix(float, float, float, float, float, float)
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.
public PdfCanvas concatMatrix(PdfArray array)
array
- affine transformation stored as a PdfArray with 6 values
public PdfCanvas concatMatrix(AffineTransform transform)
concatMatrix(double, double, double, double, double, double)
public PdfCanvas beginText()
public PdfCanvas endText()
public PdfCanvas beginVariableText()
public PdfCanvas endVariableText()
public PdfCanvas setFontAndSize(PdfFont font, float size)
font
- The font
size
- The font size.
public PdfCanvas moveText(double x, double y)
x
- x coordinate.
y
- y coordinate.
public PdfCanvas setLeading(float leading)
leading
- the new leading.
public PdfCanvas moveTextWithLeading(float x, float y)
x
- offset of the new current point
y
- y-coordinate of the new current point
public PdfCanvas newlineText()
public PdfCanvas newlineShowText(String text)
text
.
text
- the text to write
public PdfCanvas newlineShowText(float wordSpacing, float charSpacing, String text)
wordSpacing
- a parameter
charSpacing
- a parameter
text
- the text to write
public PdfCanvas setTextRenderingMode(int textRenderingMode)
textRenderingMode
- text rendering mode @see PdfCanvasConstants.
public PdfCanvas setTextRise(float textRise)
textRise
- a parameter
public PdfCanvas setWordSpacing(float wordSpacing)
wordSpacing
- a parameter
public PdfCanvas setCharacterSpacing(float charSpacing)
charSpacing
- a parameter
public PdfCanvas setHorizontalScaling(float scale)
scale
- a parameter.
public PdfCanvas setTextMatrix(float a, float b, float c, float d, float x, float y)
concatMatrix(double, double, double, double, double, double)
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.
x
- operand 3,1 in the matrix.
y
- operand 3,2 in the matrix.
public PdfCanvas setTextMatrix(AffineTransform transform)
concatMatrix(double, double, double, double, double, double)
transform
- new textmatrix as transformation
public PdfCanvas setTextMatrix(float x, float y)
x
- operand 3,1 in the matrix.
y
- operand 3,2 in the matrix.
public PdfCanvas showText(String text)
text
- text to show.
public PdfCanvas showText(GlyphLine text)
text
- text to show.
public PdfCanvas showText(GlyphLine text, Iterator<GlyphLine.GlyphLinePart> iterator)
text
- text to show.
iterator
- iterator over parts of the glyph line that should be wrapped into some marked content groups, e.g. /ActualText or /ReversedChars
public PdfCanvas showText(PdfArray textArray)
textArray
- the text array. Each element of array can be a string or a number. If the element is a string, this operator shows the string. If it is a number, the operator adjusts the text position by that amount. The number is expressed in thousandths of a unit of text space. This amount is subtracted from the current horizontal or vertical coordinate, depending on the writing mode.
public PdfCanvas moveTo(double x, double y)
x
- x coordinate.
y
- y coordinate.
public PdfCanvas lineTo(double x, double y)
x
- x coordinate.
y
- y coordinate.
public PdfCanvas curveTo(double x1, double y1, double x2, double y2, double x3, double y3)
x1
- x coordinate of the first control point.
y1
- y coordinate of the first control point.
x2
- x coordinate of the second control point.
y2
- y coordinate of the second control point.
x3
- x coordinate of the ending point.
y3
- y coordinate of the ending point.
public PdfCanvas curveTo(double x2, double y2, double x3, double y3)
x2
- x coordinate of the second control point.
y2
- y coordinate of the second control point.
x3
- x coordinate of the ending point.
y3
- y coordinate of the ending point.
public PdfCanvas curveFromTo(double x1, double y1, double x3, double y3)
x1
- x coordinate of the first control point.
y1
- y coordinate of the first control point.
x3
- x coordinate of the ending point.
y3
- y coordinate of the ending point.
public PdfCanvas arc(double x1, double y1, double x2, double y2, double startAng, double extent)
x1
- a corner of the enclosing rectangle.
y1
- a corner of the enclosing rectangle.
x2
- a corner of the enclosing rectangle.
y2
- a corner of the enclosing rectangle.
startAng
- starting angle in degrees.
extent
- angle extent in degrees.
public PdfCanvas ellipse(double x1, double y1, double x2, double y2)
x1
- a corner of the enclosing rectangle
y1
- a corner of the enclosing rectangle
x2
- a corner of the enclosing rectangle
y2
- a corner of the enclosing rectangle
public static ListbezierArc(double x1, double y1, double x2, double y2, double startAng, double extent)
x1
- a corner of the enclosing rectangle.
y1
- a corner of the enclosing rectangle.
x2
- a corner of the enclosing rectangle.
y2
- a corner of the enclosing rectangle.
startAng
- starting angle in degrees.
extent
- angle extent in degrees.
public PdfCanvas rectangle(double x, double y, double width, double height)
x
- x coordinate of the starting point.
y
- y coordinate of the starting point.
width
- width.
height
- height.
public PdfCanvas rectangle(Rectangle rectangle)
rectangle
- a rectangle to be drawn
public PdfCanvas roundRectangle(double x, double y, double width, double height, double radius)
x
- x coordinate of the starting point.
y
- y coordinate of the starting point.
width
- width.
height
- height.
radius
- radius of the arc corner.
public PdfCanvas circle(double x, double y, double r)
x
- x center of circle.
y
- y center of circle.
r
- radius of circle.
public PdfCanvas paintShading(PdfShading shading)
shading
-
public PdfCanvas closePath()
public PdfCanvas closePathEoFillStroke()
public PdfCanvas closePathFillStroke()
public PdfCanvas newPath()
public PdfCanvas stroke()
public PdfCanvas clip()
public PdfCanvas eoClip()
public PdfCanvas closePathStroke()
public PdfCanvas fill()
public PdfCanvas fillStroke()
public PdfCanvas eoFill()
public PdfCanvas eoFillStroke()
public PdfCanvas setLineWidth(float lineWidth)
lineWidth
- line width.
public PdfCanvas setLineCapStyle(int lineCapStyle)
lineCapStyle
-
for possible values.
public PdfCanvas setLineJoinStyle(int lineJoinStyle)
lineJoinStyle
-
for possible values.
public PdfCanvas setMiterLimit(float miterLimit)
miterLimit
-
public PdfCanvas setLineDash(float phase)
phase
- the value of the phase
public PdfCanvas setLineDash(float unitsOn, float phase)
phase
- the value of the phase
unitsOn
- the number of units that must be 'on' (equals the number of units that must be 'off').
public PdfCanvas setLineDash(float unitsOn, float unitsOff, float phase)
phase
- the value of the phase
unitsOn
- the number of units that must be 'on'
unitsOff
- the number of units that must be 'off'
public PdfCanvas setLineDash(float[] array, float phase)
array
- length of the alternating dashes and gaps
phase
- the value of the phase
public PdfCanvas setRenderingIntent(PdfName renderingIntent)
renderingIntent
- a PdfName containing a color metric
public PdfCanvas setFlatnessTolerance(float flatnessTolerance)
flatnessTolerance
- a value
public PdfCanvas setFillColor(Color color)
color
- fill color.
public PdfCanvas setStrokeColor(Color color)
color
- stroke color.
public PdfCanvas setColor(Color color, boolean fill)
color
- the new color.
fill
- set fill color (true
) or stroke color (false
)
public PdfCanvas setColor(PdfColorSpace colorSpace, float[] colorValue, boolean fill)
colorSpace
- the color space of the new color
colorValue
- a list of numerical values with a length corresponding to the specs of the color space. Values should be in the range [0,1]
fill
- set fill color (true
) or stroke color (false
)
public PdfCanvas setColor(PdfColorSpace colorSpace, float[] colorValue, PdfPattern pattern, boolean fill)
colorSpace
- the color space of the new color
colorValue
- a list of numerical values with a length corresponding to the specs of the color space. Values should be in the range [0,1]
pattern
- a pattern for the colored line or area
fill
- set fill color (true
) or stroke color (false
)
public PdfCanvas setFillColorGray(float g)
g
- a grayscale value in the range [0,1]
public PdfCanvas setStrokeColorGray(float g)
g
- a grayscale value in the range [0,1]
public PdfCanvas resetFillColorGray()
public PdfCanvas resetStrokeColorGray()
public PdfCanvas setFillColorRgb(float r, float g, float b)
r
- a red value in the range [0,1]
g
- a green value in the range [0,1]
b
- a blue value in the range [0,1]
public PdfCanvas setStrokeColorRgb(float r, float g, float b)
r
- a red value in the range [0,1]
g
- a green value in the range [0,1]
b
- a blue value in the range [0,1]
public PdfCanvas setFillColorShading(PdfPattern.Shading shading)
shading
- the shading
public PdfCanvas setStrokeColorShading(PdfPattern.Shading shading)
shading
- the shading
public PdfCanvas resetFillColorRgb()
public PdfCanvas resetStrokeColorRgb()
public PdfCanvas setFillColorCmyk(float c, float m, float y, float k)
c
- a cyan value in the range [0,1]
m
- a magenta value in the range [0,1]
y
- a yellow value in the range [0,1]
k
- a key (black) value in the range [0,1]
public PdfCanvas setStrokeColorCmyk(float c, float m, float y, float k)
c
- a cyan value in the range [0,1]
m
- a magenta value in the range [0,1]
y
- a yellow value in the range [0,1]
k
- a key (black) value in the range [0,1]
public PdfCanvas resetFillColorCmyk()
public PdfCanvas resetStrokeColorCmyk()
public PdfCanvas beginLayer(IPdfOCG layer)
layer
. Blocks can be nested. Each block must be terminated by an endLayer()
.
Note that nested layers with PdfLayer.addChild(PdfLayer)
only require a single call to this method and a single call to endLayer()
; all the nesting control is built in.
layer
- The layer to begin
public PdfCanvas endLayer()
public PdfXObject addImage(ImageData image, float a, float b, float c, float d, float e, float f)
image
- the PdfImageXObject
object
a
- an element of the transformation matrix
b
- an element of the transformation matrix
c
- an element of the transformation matrix
d
- an element of the transformation matrix
e
- an element of the transformation matrix
f
- an element of the transformation matrix
public PdfXObject addImage(ImageData image, float a, float b, float c, float d, float e, float f, boolean asInline)
image
- the PdfImageXObject
object
a
- an element of the transformation matrix
b
- an element of the transformation matrix
c
- an element of the transformation matrix
d
- an element of the transformation matrix
e
- an element of the transformation matrix
f
- an element of the transformation matrix
asInline
- true if to add image as in-line.
public PdfXObject addImage(ImageData image, Rectangle rect, boolean asInline)
image
-
rect
-
asInline
- true if to add image as in-line.
public PdfXObject addImage(ImageData image, float x, float y, boolean asInline)
image
-
x
-
y
-
asInline
- true if to add image as in-line.
public PdfXObject addImage(ImageData image, float x, float y, float width, boolean asInline)
image
-
x
-
y
-
width
-
asInline
- true if to add image as in-line.
public PdfXObject addImage(ImageData image, float x, float y, float height, boolean asInline, boolean dummy)
image
-
x
-
y
-
height
-
asInline
- true if to add image as in-line.
dummy
-
public PdfCanvas addXObject(PdfXObject xObject, float a, float b, float c, float d, float e, float f)
PdfXObject
to canvas.
xObject
- the PdfImageXObject
object
a
- an element of the transformation matrix
b
- an element of the transformation matrix
c
- an element of the transformation matrix
d
- an element of the transformation matrix
e
- an element of the transformation matrix
f
- an element of the transformation matrix
public PdfCanvas addXObject(PdfXObject xObject, float x, float y)
PdfXObject
to the specified position.
xObject
-
x
-
y
-
public PdfCanvas addXObject(PdfXObject xObject, Rectangle rect)
PdfXObject
to specified rectangle on canvas.
xObject
-
rect
-
public PdfCanvas addXObject(PdfXObject xObject, float x, float y, float width)
PdfXObject
to the specified position with specified width preserving aspect ratio.
xObject
-
x
-
y
-
width
-
public PdfCanvas addXObject(PdfXObject xObject, float x, float y, float height, boolean dummy)
PdfXObject
to the specified position with specified height preserving aspect ratio.
xObject
-
x
-
y
-
height
-
dummy
-
public PdfCanvas setExtGState(PdfExtGState extGState)
extGState
- a dictionary that maps resource names to graphics state parameter dictionaries
public PdfExtGState setExtGState(PdfDictionary extGState)
extGState
- a dictionary that maps resource names to graphics state parameter dictionaries
public PdfCanvas beginMarkedContent(PdfName tag)
tag
- the type of content contained
public PdfCanvas beginMarkedContent(PdfName tag, PdfDictionary properties)
tag
- the type of content that will be contained
properties
- the properties of the content, including Marked Content ID. If null, the PDF marker is BMC, else it is BDC
public PdfCanvas endMarkedContent()
public PdfCanvas openTag(CanvasTag tag)
tag
- the type of content that will be contained
public PdfCanvas openTag(TagReference tagReference)
tagReference
- reference to the tag from the document logical structure
public PdfCanvas closeTag()
public PdfCanvas writeLiteral(String s)
String
directly to the content.
s
- the String
public PdfCanvas writeLiteral(char c)
char
directly to the content.
c
- the char
public PdfCanvas writeLiteral(float n)
float
directly to the content.
n
- the float
public PdfStream getContentStream()
protected void addInlineImage(PdfImageXObject imageXObject, float a, float b, float c, float d, float e, float f)
PdfImageXObject
to canvas.
imageXObject
- the PdfImageXObject
object
a
- an element of the transformation matrix
b
- an element of the transformation matrix
c
- an element of the transformation matrix
d
- an element of the transformation matrix
e
- an element of the transformation matrix
f
- an element of the transformation matrix
Copyright © 1998–2018 iText Group NV. All rights reserved.