public class PdfContentByte extends Object
PdfContentByte
is an object containing the user positioned text and graphic contents of a page. It knows how to apply the proper font encoding.
Modifier and Type | Class and Description |
---|---|
static class |
PdfContentByte.GraphicState
This class keeps the graphic state of the current page
|
Modifier and Type | Field and Description |
---|---|
static int |
ALIGN_CENTER
The alignment is center
|
static int |
ALIGN_LEFT
The alignment is left
|
static int |
ALIGN_RIGHT
The alignment is right
|
protected ByteBuffer |
content
This is the actual content
|
protected PdfContentByte |
duplicatedFrom |
protected ArrayList<Integer> |
layerDepth
The list were we save/restore the layer depth
|
static int |
LINE_CAP_BUTT
A possible line cap value
|
static int |
LINE_CAP_PROJECTING_SQUARE
A possible line cap value
|
static int |
LINE_CAP_ROUND
A possible line cap value
|
static int |
LINE_JOIN_BEVEL
A possible line join value
|
static int |
LINE_JOIN_MITER
A possible line join value
|
static int |
LINE_JOIN_ROUND
A possible line join value
|
protected int |
markedContentSize |
protected PdfDocument |
pdf
This is the PdfDocument
|
protected int |
separator
The separator between commands.
|
protected PdfContentByte.GraphicState |
state
This is the GraphicState in use
|
protected ArrayList<PdfContentByte.GraphicState> |
stateList
The list were we save/restore the state
|
static int |
TEXT_RENDER_MODE_CLIP
A possible text rendering value
|
static int |
TEXT_RENDER_MODE_FILL
A possible text rendering value
|
static int |
TEXT_RENDER_MODE_FILL_CLIP
A possible text rendering value
|
static int |
TEXT_RENDER_MODE_FILL_STROKE
A possible text rendering value
|
static int |
TEXT_RENDER_MODE_FILL_STROKE_CLIP
A possible text rendering value
|
static int |
TEXT_RENDER_MODE_INVISIBLE
A possible text rendering value
|
static int |
TEXT_RENDER_MODE_STROKE
A possible text rendering value
|
static int |
TEXT_RENDER_MODE_STROKE_CLIP
A possible text rendering value
|
protected PdfWriter |
writer
This is the writer
|
Constructor and Description |
---|
PdfContentByte(PdfWriter wr)
Constructs a new PdfContentByte -object.
|
Modifier and Type | Method and Description |
---|---|
void |
add(PdfContentByte other)
Adds the content of another PdfContentByte -object to this object.
|
void |
addAnnotation(PdfAnnotation annot, boolean applyCTM) |
PdfName |
addFormXObj(PdfStream formXObj, PdfName name, double a, double b, double c, double d, double e, double f)
Adds a form XObject to this content.
|
PdfName |
addFormXObj(PdfStream formXObj, PdfName name, float a, float b, float c, float d, float e, float f)
Adds a form XObject to this content.
|
void |
addImage(Image image)
Adds an Image to the page.
|
void |
addImage(Image image, AffineTransform transform)
adds an image with the given matrix.
|
void |
addImage(Image image, AffineTransform transform)
Deprecated.
use com.itextpdf.text.geom.AffineTransform as parameter
|
void |
addImage(Image image, boolean inlineImage)
Adds an Image to the page.
|
void |
addImage(Image image, double a, double b, double c, double d, double e, double f)
Adds an Image to the page.
|
void |
addImage(Image image, double a, double b, double c, double d, double e, double f, boolean inlineImage)
Adds an Image to the page.
|
protected void |
addImage(Image image, double a, double b, double c, double d, double e, double f, boolean inlineImage, boolean isMCBlockOpened)
Adds an Image to the page.
|
void |
addImage(Image image, float a, float b, float c, float d, float e, float f)
Adds an Image to the page.
|
void |
addImage(Image image, float a, float b, float c, float d, float e, float f, boolean inlineImage)
Adds an Image to the page.
|
void |
addOutline(PdfOutline outline, String name)
Adds a named outline to the document.
|
void |
addPSXObject(PdfPSXObject psobject)
Adds a PostScript XObject to this content.
|
void |
addTemplate(PdfTemplate template, AffineTransform transform)
adds a template with the given matrix.
|
void |
addTemplate(PdfTemplate template, AffineTransform transform)
Deprecated.
use com.itextpdf.text.geom.AffineTransform as parameter
|
void |
addTemplate(PdfTemplate template, AffineTransform transform, boolean tagContent)
adds a template with the given matrix.
|
void |
addTemplate(PdfTemplate template, double x, double y)
Adds a template to this content.
|
void |
addTemplate(PdfTemplate template, double x, double y, boolean tagContent) |
void |
addTemplate(PdfTemplate template, double a, double b, double c, double d, double e, double f)
Adds a template to this content.
|
void |
addTemplate(PdfTemplate template, double a, double b, double c, double d, double e, double f, boolean tagContent)
Adds a template to this content.
|
void |
addTemplate(PdfTemplate template, float x, float y)
Adds a template to this content.
|
void |
addTemplate(PdfTemplate template, float x, float y, boolean tagContent) |
void |
addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f)
Adds a template to this content.
|
void |
addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f, boolean tagContent)
Adds a template to this content.
|
void |
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 |
arc(float x1, float y1, float x2, float y2, float startAng, float extent)
Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2, starting at startAng degrees and covering extent degrees.
|
void |
beginLayer(PdfOCG layer)
Begins a graphic block whose visibility is controlled by the layer .
|
void |
beginMarkedContentSequence(PdfName tag)
This is just a shorthand to beginMarkedContentSequence(tag, null, false) .
|
void |
beginMarkedContentSequence(PdfName tag, PdfDictionary property, boolean inline)
Begins a marked content sequence.
|
void |
beginMarkedContentSequence(PdfStructureElement struc)
Begins a marked content sequence.
|
void |
beginText()
Starts the writing of text.
|
protected void |
beginText(boolean restoreTM)
Starts the writing of text.
|
static ArrayList |
bezierArc(double x1, double y1, double x2, double y2, double startAng, double extent)
Generates an array of bezier curves to draw an arc.
|
static ArrayList |
bezierArc(float x1, float y1, float x2, float y2, float startAng, float extent)
Generates an array of bezier curves to draw an arc.
|
protected void |
checkState() |
protected void |
checkWriter()
Check if we have a valid PdfWriter.
|
void |
circle(double x, double y, double r)
Draws a circle.
|
void |
circle(float x, float y, float r)
Draws a circle.
|
void |
clip()
Modify the current clipping path by intersecting it with the current path, using the nonzero winding number rule to determine which regions lie inside the clipping path.
|
void |
closeMCBlock(IAccessibleElement element) |
void |
closePath()
Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath.
|
void |
closePathEoFillStroke()
Closes the path, fills it using the even-odd rule to determine the region to fill and strokes it.
|
void |
closePathFillStroke()
Closes the path, fills it using the non-zero winding number rule to determine the region to fill and strokes it.
|
void |
closePathStroke()
Closes the path and strokes it.
|
void |
concatCTM(AffineTransform transform)
Concatenate a matrix to the current transformation matrix.
|
void |
concatCTM(AffineTransform transform)
Deprecated.
use com.itextpdf.text.geom.AffineTransform as parameter
|
void |
concatCTM(double a, double b, double c, double d, double e, double f)
Concatenate a matrix to the current transformation matrix.
|
void |
concatCTM(float a, float b, float c, float d, float e, float f)
Concatenate a matrix to the current transformation matrix.
|
PdfAppearance |
createAppearance(float width, float height)
Creates a new appearance to be used with form fields.
|
Graphics2D |
createGraphics(float width, float height)
Deprecated.
use the constructor in PdfGraphics2D
|
Graphics2D |
createGraphics(float width, float height, boolean convertImagesToJPEG, float quality)
Deprecated.
use the constructor in PdfGraphics2D
|
Graphics2D |
createGraphics(float width, float height, FontMapper fontMapper)
Deprecated.
use the constructor in PdfPrinterGraphics2D
|
Graphics2D |
createGraphics(float width, float height, FontMapper fontMapper, boolean convertImagesToJPEG, float quality)
Deprecated.
use the constructor in PdfPrinterGraphics2D
|
Graphics2D |
createGraphicsShapes(float width, float height)
Deprecated.
use the constructor in PdfGraphics2D
|
Graphics2D |
createGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality)
Deprecated.
use the constructor in PdfPrinterGraphics2D
|
PdfPatternPainter |
createPattern(float width, float height)
Create a new colored tiling pattern.
|
PdfPatternPainter |
createPattern(float width, float height, BaseColor color)
Create a new uncolored tiling pattern.
|
PdfPatternPainter |
createPattern(float width, float height, float xstep, float ystep)
Create a new colored tiling pattern.
|
PdfPatternPainter |
createPattern(float width, float height, float xstep, float ystep, BaseColor color)
Create a new uncolored tiling pattern.
|
Graphics2D |
createPrinterGraphics(float width, float height, boolean convertImagesToJPEG, float quality, PrinterJob printerJob)
Deprecated.
use the constructor in PdfGraphics2D
|
Graphics2D |
createPrinterGraphics(float width, float height, FontMapper fontMapper, boolean convertImagesToJPEG, float quality, PrinterJob printerJob)
Deprecated.
use the constructor in PdfPrinterGraphics2D
|
Graphics2D |
createPrinterGraphics(float width, float height, FontMapper fontMapper, PrinterJob printerJob)
Deprecated.
use the constructor in PdfPrinterGraphics2D
|
Graphics2D |
createPrinterGraphics(float width, float height, PrinterJob printerJob)
Deprecated.
use the constructor in PdfPrinterGraphics2D
|
Graphics2D |
createPrinterGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality, PrinterJob printerJob)
Deprecated.
use the constructor in PdfPrinterGraphics2D
|
Graphics2D |
createPrinterGraphicsShapes(float width, float height, PrinterJob printerJob)
Deprecated.
use the constructor in PdfPrinterGraphics2D
|
PdfTemplate |
createTemplate(float width, float height)
Creates a new template.
|
void |
curveFromTo(double x1, double y1, double x3, double y3)
Appends a Bêzier curve to the path, starting from the current point.
|
void |
curveFromTo(float x1, float y1, float x3, float y3)
Appends a Bêzier curve to the path, starting from the current point.
|
void |
curveTo(double x2, double y2, double x3, double y3)
Appends a Bêzier curve to the path, starting from the current point.
|
void |
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.
|
void |
curveTo(float x2, float y2, float x3, float y3)
Appends a Bêzier curve to the path, starting from the current point.
|
void |
curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
Appends a Bêzier curve to the path, starting from the current point.
|
void |
drawButton(double llx, double lly, double urx, double ury, String text, BaseFont bf, float size)
Draws a button.
|
void |
drawButton(float llx, float lly, float urx, float ury, String text, BaseFont bf, float size)
Draws a button.
|
void |
drawRadioField(double llx, double lly, double urx, double ury, boolean on)
Draws a TextField.
|
void |
drawRadioField(float llx, float lly, float urx, float ury, boolean on)
Draws a TextField.
|
void |
drawTextField(double llx, double lly, double urx, double ury)
Draws a TextField.
|
void |
drawTextField(float llx, float lly, float urx, float ury)
Draws a TextField.
|
void |
ellipse(double x1, double y1, double x2, double y2)
Draws an ellipse inscribed within the rectangle x1,y1,x2,y2.
|
void |
ellipse(float x1, float y1, float x2, float y2)
Draws an ellipse inscribed within the rectangle x1,y1,x2,y2.
|
void |
endLayer()
Ends a layer controlled graphic block.
|
void |
endMarkedContentSequence()
Ends a marked content sequence
|
void |
endText()
Ends the writing of text and makes the current font invalid.
|
void |
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.
|
void |
eoFill()
Fills the path, using the even-odd rule to determine the region to fill.
|
void |
eoFillStroke()
Fills the path, using the even-odd rule to determine the region to fill and strokes it.
|
void |
fill()
Fills the path, using the non-zero winding number rule to determine the region to fill.
|
void |
fillStroke()
Fills the path using the non-zero winding number rule to determine the region to fill and strokes it.
|
float |
getCharacterSpacing()
Gets the current character spacing.
|
protected PdfIndirectReference |
getCurrentPage() |
PdfContentByte |
getDuplicate()
Gets a duplicate of this PdfContentByte .
|
PdfContentByte |
getDuplicate(boolean inheritGraphicState) |
float |
getEffectiveStringWidth(String text, boolean kerned)
Computes the width of the given string taking in account the current values of "Character spacing", "Word Spacing" and "Horizontal Scaling".
|
float |
getHorizontalScaling()
Gets the current character spacing.
|
ByteBuffer |
getInternalBuffer()
Gets the internal buffer.
|
protected boolean |
getInText() |
static PdfTextArray |
getKernArray(String text, BaseFont font)
Constructs a kern array for a text in a certain font
|
float |
getLeading()
Gets the current text leading.
|
protected int |
getMcDepth() |
protected ArrayList<IAccessibleElement> |
getMcElements() |
PdfDocument |
getPdfDocument()
Gets the PdfDocument in use by this object.
|
PdfWriter |
getPdfWriter()
Gets the PdfWriter in use by this object.
|
PdfOutline |
getRootOutline()
Gets the root outline.
|
float |
getWordSpacing()
Gets the current word spacing.
|
float |
getXTLM()
Gets the x position of the text line matrix.
|
float |
getYTLM()
Gets the y position of the text line matrix.
|
void |
inheritGraphicState(PdfContentByte parentCanvas) |
boolean |
isTagged()
Checks if the content needs to be tagged.
|
boolean |
isTaggingSuppressed()
[SUP-1395] If set, prevents iText from marking content and creating structure tags for items added to this content stream.
|
void |
lineTo(double x, double y)
Appends a straight line segment from the current point (x, y).
|
void |
lineTo(float x, float y)
Appends a straight line segment from the current point (x, y).
|
boolean |
localDestination(String name, PdfDestination destination)
The local destination to where a local goto with the same name will jump.
|
void |
localGoto(String name, float llx, float lly, float urx, float ury)
Implements a link to other part of the document.
|
void |
moveText(float x, float y)
Moves to the start of the next line, offset from the start of the current line.
|
void |
moveTextWithLeading(float x, float y)
Moves to the start of the next line, offset from the start of the current line.
|
void |
moveTo(double x, double y)
Move the current point (x, y), omitting any connecting line segment.
|
void |
moveTo(float x, float y)
Move the current point (x, y), omitting any connecting line segment.
|
void |
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.
|
void |
newlineShowText(String text)
Moves to the next line and shows text .
|
void |
newlineText()
Moves to the start of the next line.
|
void |
newPath()
Ends the path without filling or stroking it.
|
void |
openMCBlock(IAccessibleElement element) |
void |
paintShading(PdfShading shading)
Paints using a shading object.
|
void |
paintShading(PdfShadingPattern shading)
Paints using a shading pattern.
|
void |
rectangle(double x, double y, double w, double h)
Adds a rectangle to the current path.
|
void |
rectangle(float x, float y, float w, float h)
Adds a rectangle to the current path.
|
void |
rectangle(Rectangle rectangle)
Adds a border (complete or partially) to the current path..
|
void |
remoteGoto(String filename, int page, float llx, float lly, float urx, float ury)
Implements a link to another document.
|
void |
remoteGoto(String filename, String name, float llx, float lly, float urx, float ury)
Implements a link to another document.
|
void |
reset()
Makes this PdfContentByte empty.
|
void |
reset(boolean validateContent)
Makes this PdfContentByte empty.
|
void |
resetCMYKColorFill()
Changes the current color for filling paths to black.
|
void |
resetCMYKColorStroke()
Changes the current color for stroking paths to black.
|
void |
resetGrayFill()
Changes the current gray tint for filling paths to black.
|
void |
resetGrayStroke()
Changes the current gray tint for stroking paths to black.
|
void |
resetRGBColorFill()
Changes the current color for filling paths to black.
|
void |
resetRGBColorStroke()
Changes the current color for stroking paths to black.
|
protected void |
restoreMCBlocks(ArrayList<IAccessibleElement> mcElements) |
void |
restoreState()
Restores the graphic state.
|
void |
roundRectangle(double x, double y, double w, double h, double r)
Adds a round rectangle to the current path.
|
void |
roundRectangle(float x, float y, float w, float h, float r)
Adds a round rectangle to the current path.
|
void |
sanityCheck()
Checks for any dangling state: Mismatched save/restore state, begin/end text, begin/end layer, or begin/end marked content sequence.
|
protected ArrayList<IAccessibleElement> |
saveMCBlocks() |
void |
saveState()
Saves the graphic state.
|
void |
setAction(PdfAction action, float llx, float lly, float urx, float ury)
Implements an action in an area.
|
void |
setCharacterSpacing(float charSpace)
Sets the character spacing parameter.
|
void |
setCMYKColorFill(int cyan, int magenta, int yellow, int black)
Changes the current color for filling paths (device dependent colors!).
|
void |
setCMYKColorFillF(float cyan, float magenta, float yellow, float black)
Changes the current color for filling paths (device dependent colors!).
|
void |
setCMYKColorStroke(int cyan, int magenta, int yellow, int black)
Changes the current color for stroking paths (device dependent colors!).
|
void |
setCMYKColorStrokeF(float cyan, float magenta, float yellow, float black)
Changes the current color for stroking paths (device dependent colors!).
|
void |
setColorFill(BaseColor color)
Sets the fill color.
|
void |
setColorFill(PdfDeviceNColor dn, float[] tints) |
void |
setColorFill(PdfLabColor lab, float l, float a, float b) |
void |
setColorFill(PdfSpotColor sp, float tint)
Sets the fill color to a spot color.
|
void |
setColorStroke(BaseColor color)
Sets the stroke color.
|
void |
setColorStroke(PdfDeviceNColor sp, float[] tints) |
void |
setColorStroke(PdfLabColor lab, float l, float a, float b) |
void |
setColorStroke(PdfSpotColor sp, float tint)
Sets the stroke color to a spot color.
|
void |
setDefaultColorspace(PdfName name, PdfObject obj)
Sets the default colorspace.
|
void |
setFlatness(double flatness)
Changes the Flatness.
|
void |
setFlatness(float flatness)
Changes the Flatness.
|
void |
setFontAndSize(BaseFont bf, float size)
Set the font and the size for the subsequent text writing.
|
void |
setGrayFill(float gray)
Changes the currentgray tint for filling paths (device dependent colors!).
|
void |
setGrayStroke(float gray)
Changes the currentgray tint for stroking paths (device dependent colors!).
|
void |
setGState(PdfGState gstate)
Sets the graphic state
|
void |
setHorizontalScaling(float scale)
Sets the horizontal scaling parameter.
|
void |
setLeading(float leading)
Sets the text leading parameter.
|
void |
setLineCap(int style)
Changes the Line cap style.
|
void |
setLineDash(double phase)
Changes the value of the line dash pattern.
|
void |
setLineDash(double[] array, double phase)
Changes the value of the line dash pattern.
|
void |
setLineDash(double unitsOn, double phase)
Changes the value of the line dash pattern.
|
void |
setLineDash(double unitsOn, double unitsOff, double phase)
Changes the value of the line dash pattern.
|
void |
setLineDash(float phase)
Changes the value of the line dash pattern.
|
void |
setLineDash(float[] array, float phase)
Changes the value of the line dash pattern.
|
void |
setLineDash(float unitsOn, float phase)
Changes the value of the line dash pattern.
|
void |
setLineDash(float unitsOn, float unitsOff, float phase)
Changes the value of the line dash pattern.
|
void |
setLineJoin(int style)
Changes the Line join style.
|
void |
setLineWidth(double w)
Changes the line width.
|
void |
setLineWidth(float w)
Changes the line width.
|
void |
setLiteral(char c)
Outputs a char directly to the content.
|
void |
setLiteral(float n)
Outputs a float directly to the content.
|
void |
setLiteral(String s)
Outputs a String directly to the content.
|
protected void |
setMcDepth(int value) |
protected void |
setMcElements(ArrayList<IAccessibleElement> value) |
void |
setMiterLimit(double miterLimit)
Changes the Miter limit.
|
void |
setMiterLimit(float miterLimit)
Changes the Miter limit.
|
void |
setPatternFill(PdfPatternPainter p)
Sets the fill color to a pattern.
|
void |
setPatternFill(PdfPatternPainter p, BaseColor color)
Sets the fill color to an uncolored pattern.
|
void |
setPatternFill(PdfPatternPainter p, BaseColor color, float tint)
Sets the fill color to an uncolored pattern.
|
void |
setPatternStroke(PdfPatternPainter p)
Sets the stroke color to a pattern.
|
void |
setPatternStroke(PdfPatternPainter p, BaseColor color)
Sets the stroke color to an uncolored pattern.
|
void |
setPatternStroke(PdfPatternPainter p, BaseColor color, float tint)
Sets the stroke color to an uncolored pattern.
|
void |
setRenderingIntent(PdfName ri)
Set the rendering intent, possible values are: PdfName.ABSOLUTECOLORIMETRIC, PdfName.RELATIVECOLORIMETRIC, PdfName.SATURATION, PdfName.PERCEPTUAL.
|
void |
setRGBColorFill(int red, int green, int blue)
Changes the current color for filling paths (device dependent colors!).
|
void |
setRGBColorFillF(float red, float green, float blue)
Changes the current color for filling paths (device dependent colors!).
|
void |
setRGBColorStroke(int red, int green, int blue)
Changes the current color for stroking paths (device dependent colors!).
|
void |
setRGBColorStrokeF(float red, float green, float blue)
Changes the current color for stroking paths (device dependent colors!).
|
void |
setShadingFill(PdfShadingPattern shading)
Sets the shading fill pattern.
|
void |
setShadingStroke(PdfShadingPattern shading)
Sets the shading stroke pattern
|
PdfContentByte |
setSuppressTagging(boolean suppressTagging)
[SUP-1395] If set, prevents iText from marking content and creating structure tags for items added to this content stream.
|
void |
setTextMatrix(AffineTransform transform)
Changes the text matrix.
|
void |
setTextMatrix(AffineTransform transform)
Deprecated.
use com.itextpdf.text.geom.AffineTransform as parameter
|
void |
setTextMatrix(float x, float y)
Changes the text matrix.
|
void |
setTextMatrix(float a, float b, float c, float d, float x, float y)
Changes the text matrix.
|
void |
setTextRenderingMode(int rendering)
Sets the text rendering parameter.
|
void |
setTextRise(double rise)
Sets the text rise parameter.
|
void |
setTextRise(float rise)
Sets the text rise parameter.
|
void |
setWordSpacing(float wordSpace)
Sets the word spacing parameter.
|
void |
showText(PdfTextArray text)
Show an array of text.
|
void |
showText(String text)
Shows the text .
|
void |
showTextAligned(int alignment, String text, float x, float y, float rotation)
Shows text right, left or center aligned with rotation.
|
void |
showTextAlignedKerned(int alignment, String text, float x, float y, float rotation)
Shows text kerned right, left or center aligned with rotation.
|
void |
showTextGid(String gids) |
void |
showTextKerned(String text)
Shows the text kerned.
|
void |
stroke()
Strokes the path.
|
byte[] |
toPdf(PdfWriter writer)
Returns the PDF representation of this PdfContentByte -object.
|
String |
toString()
Returns the String representation of this PdfContentByte -object.
|
void |
transform(AffineTransform af)
Concatenates a transformation to the current transformation matrix.
|
void |
transform(AffineTransform af)
Deprecated.
use com.itextpdf.text.geom.AffineTransform as parameter
|
protected void |
updateTx(String text, float Tj) |
void |
variableRectangle(Rectangle rect)
Adds a variable width border to the current path.
|
public static final int ALIGN_CENTER
public static final int ALIGN_LEFT
public static final int ALIGN_RIGHT
public static final int LINE_CAP_BUTT
public static final int LINE_CAP_ROUND
public static final int LINE_CAP_PROJECTING_SQUARE
public static final int LINE_JOIN_MITER
public static final int LINE_JOIN_ROUND
public static final int LINE_JOIN_BEVEL
public static final int TEXT_RENDER_MODE_FILL
public static final int TEXT_RENDER_MODE_STROKE
public static final int TEXT_RENDER_MODE_FILL_STROKE
public static final int TEXT_RENDER_MODE_INVISIBLE
public static final int TEXT_RENDER_MODE_FILL_CLIP
public static final int TEXT_RENDER_MODE_STROKE_CLIP
public static final int TEXT_RENDER_MODE_FILL_STROKE_CLIP
public static final int TEXT_RENDER_MODE_CLIP
protected ByteBuffer content
protected int markedContentSize
protected PdfWriter writer
protected PdfDocument pdf
protected PdfContentByte.GraphicState state
protected ArrayList<PdfContentByte.GraphicState> stateList
protected int separator
protected PdfContentByte duplicatedFrom
public PdfContentByte(PdfWriter wr)
PdfContentByte
-object.
wr
- the writer associated to this content
public String toString()
String
representation of this PdfContentByte
-object.
public boolean isTaggingSuppressed()
public PdfContentByte setSuppressTagging(boolean suppressTagging)
public boolean isTagged()
public ByteBuffer getInternalBuffer()
public byte[] toPdf(PdfWriter writer)
PdfContentByte
-object.
writer
- the PdfWriter
byte
array with the representation
public void add(PdfContentByte other)
PdfContentByte
-object to this object.
other
- another PdfByteContent
-object
public float getXTLM()
public float getYTLM()
public float getLeading()
public float getCharacterSpacing()
public float getWordSpacing()
public float getHorizontalScaling()
public void setFlatness(float flatness)
Flatness sets the maximum permitted distance in device pixels between the mathematically correct path and an approximation constructed from straight line segments.
flatness
- a value
public void setFlatness(double flatness)
Flatness sets the maximum permitted distance in device pixels between the mathematically correct path and an approximation constructed from straight line segments.
flatness
- a value
public void setLineCap(int style)
The line cap style specifies the shape to be used at the end of open subpaths when they are stroked.
Allowed values are LINE_CAP_BUTT, LINE_CAP_ROUND and LINE_CAP_PROJECTING_SQUARE.
style
- a value
public void setRenderingIntent(PdfName ri)
ri
-
public void setLineDash(float phase)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by an array and a phase. The array specifies the length of the alternating dashes and gaps. The phase specifies the distance into the dash pattern to start the dash.
phase
- the value of the phase
public void setLineDash(double phase)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by an array and a phase. The array specifies the length of the alternating dashes and gaps. The phase specifies the distance into the dash pattern to start the dash.
phase
- the value of the phase
public void setLineDash(float unitsOn, float phase)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by an array and a phase. The array specifies the length of the alternating dashes and gaps. The phase specifies the distance into the dash pattern to start the dash.
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 void setLineDash(double unitsOn, double phase)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by an array and a phase. The array specifies the length of the alternating dashes and gaps. The phase specifies the distance into the dash pattern to start the dash.
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 void setLineDash(float unitsOn, float unitsOff, float phase)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by an array and a phase. The array specifies the length of the alternating dashes and gaps. The phase specifies the distance into the dash pattern to start the dash.
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 void setLineDash(double unitsOn, double unitsOff, double phase)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by an array and a phase. The array specifies the length of the alternating dashes and gaps. The phase specifies the distance into the dash pattern to start the dash.
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 final void setLineDash(float[] array, float phase)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by an array and a phase. The array specifies the length of the alternating dashes and gaps. The phase specifies the distance into the dash pattern to start the dash.
array
- length of the alternating dashes and gaps
phase
- the value of the phase
public final void setLineDash(double[] array, double phase)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by an array and a phase. The array specifies the length of the alternating dashes and gaps. The phase specifies the distance into the dash pattern to start the dash.
array
- length of the alternating dashes and gaps
phase
- the value of the phase
public void setLineJoin(int style)
The line join style specifies the shape to be used at the corners of paths that are stroked.
Allowed values are LINE_JOIN_MITER (Miter joins), LINE_JOIN_ROUND (Round joins) and LINE_JOIN_BEVEL (Bevel joins).
style
- a value
public void setLineWidth(float w)
The line width specifies the thickness of the line used to stroke a path and is measured in user space units.
w
- a width
public void setLineWidth(double w)
The line width specifies the thickness of the line used to stroke a path and is measured in user space units.
w
- a width
public void setMiterLimit(float miterLimit)
When two line segments meet at a sharp angle and mitered joins have been specified as the line join style, it is possible for the miter to extend far beyond the thickness of the line stroking path. The miter limit imposes a maximum on the ratio of the miter length to the line witdh. When the limit is exceeded, the join is converted from a miter to a bevel.
miterLimit
- a miter limit
public void setMiterLimit(double miterLimit)
When two line segments meet at a sharp angle and mitered joins have been specified as the line join style, it is possible for the miter to extend far beyond the thickness of the line stroking path. The miter limit imposes a maximum on the ratio of the miter length to the line witdh. When the limit is exceeded, the join is converted from a miter to a bevel.
miterLimit
- a miter limit
public void clip()
public void eoClip()
public void setGrayFill(float gray)
Sets the color space to DeviceGray (or the DefaultGray color space), and sets the gray tint to use for filling paths.
gray
- a value between 0 (black) and 1 (white)
public void resetGrayFill()
public void setGrayStroke(float gray)
Sets the color space to DeviceGray (or the DefaultGray color space), and sets the gray tint to use for stroking paths.
gray
- a value between 0 (black) and 1 (white)
public void resetGrayStroke()
public void setRGBColorFillF(float red, float green, float blue)
Sets the color space to DeviceRGB (or the DefaultRGB color space), and sets the color to use for filling paths.
Following the PDF manual, each operand must be a number between 0 (minimum intensity) and 1 (maximum intensity).
red
- the intensity of red. A value between 0 and 1
green
- the intensity of green. A value between 0 and 1
blue
- the intensity of blue. A value between 0 and 1
public void resetRGBColorFill()
public void setRGBColorStrokeF(float red, float green, float blue)
Sets the color space to DeviceRGB (or the DefaultRGB color space), and sets the color to use for stroking paths.
Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and 1 (maximum intensity).
red
- the intensity of red. A value between 0 and 1
green
- the intensity of green. A value between 0 and 1
blue
- the intensity of blue. A value between 0 and 1
public void resetRGBColorStroke()
public void setCMYKColorFillF(float cyan, float magenta, float yellow, float black)
Sets the color space to DeviceCMYK (or the DefaultCMYK color space), and sets the color to use for filling paths.
Following the PDF manual, each operand must be a number between 0 (no ink) and 1 (maximum ink).
cyan
- the intensity of cyan. A value between 0 and 1
magenta
- the intensity of magenta. A value between 0 and 1
yellow
- the intensity of yellow. A value between 0 and 1
black
- the intensity of black. A value between 0 and 1
public void resetCMYKColorFill()
public void setCMYKColorStrokeF(float cyan, float magenta, float yellow, float black)
Sets the color space to DeviceCMYK (or the DefaultCMYK color space), and sets the color to use for stroking paths.
Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and 1 (maximum intensity).
cyan
- the intensity of cyan. A value between 0 and 1
magenta
- the intensity of magenta. A value between 0 and 1
yellow
- the intensity of yellow. A value between 0 and 1
black
- the intensity of black. A value between 0 and 1
public void resetCMYKColorStroke()
public void moveTo(float x, float y)
x
- new x-coordinate
y
- new y-coordinate
public void moveTo(double x, double y)
x
- new x-coordinate
y
- new y-coordinate
public void lineTo(float x, float y)
x
- new x-coordinate
y
- new y-coordinate
public void lineTo(double x, double y)
x
- new x-coordinate
y
- new y-coordinate
public void curveTo(float x1, float y1, float x2, float y2, float x3, float 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 (= new current point)
y3
- y-coordinate of the ending point (= new current point)
public void 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 (= new current point)
y3
- y-coordinate of the ending point (= new current point)
public void curveTo(float x2, float y2, float x3, float y3)
x2
- x-coordinate of the second control point
y2
- y-coordinate of the second control point
x3
- x-coordinate of the ending point (= new current point)
y3
- y-coordinate of the ending point (= new current point)
public void 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 (= new current point)
y3
- y-coordinate of the ending point (= new current point)
public void curveFromTo(float x1, float y1, float x3, float y3)
x1
- x-coordinate of the first control point
y1
- y-coordinate of the first control point
x3
- x-coordinate of the ending point (= new current point)
y3
- y-coordinate of the ending point (= new current point)
public void 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 (= new current point)
y3
- y-coordinate of the ending point (= new current point)
public void circle(float x, float y, float r)
x
- x center of circle
y
- y center of circle
r
- radius of circle
public void circle(double x, double y, double r)
x
- x center of circle
y
- y center of circle
r
- radius of circle
public void rectangle(float x, float y, float w, float h)
x
- x-coordinate of the starting point
y
- y-coordinate of the starting point
w
- width
h
- height
public void rectangle(double x, double y, double w, double h)
x
- x-coordinate of the starting point
y
- y-coordinate of the starting point
w
- width
h
- height
public void variableRectangle(Rectangle rect)
Rectangle.isUseVariableBorders
= true.
rect
- a Rectangle
public void rectangle(Rectangle rectangle)
rectangle
- a Rectangle
public void closePath()
public void newPath()
public void stroke()
public void closePathStroke()
public void fill()
public void eoFill()
public void fillStroke()
public void closePathFillStroke()
public void eoFillStroke()
public void closePathEoFillStroke()
public void addImage(Image image) throws DocumentException
Image
to the page. The Image
must have absolute positioning.
image
- the Image
object
DocumentException
- if the Image
does not have absolute positioning
public void addImage(Image image, boolean inlineImage) throws DocumentException
Image
to the page. The Image
must have absolute positioning. The image can be placed inline.
image
- the Image
object
inlineImage
- true
to place this image inline, false
otherwise
DocumentException
- if the Image
does not have absolute positioning
public void addImage(Image image, float a, float b, float c, float d, float e, float f) throws DocumentException
Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y) use addImage(image, image_width, 0, 0, image_height, x, y).
image
- the Image
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
DocumentException
- on error
public void addImage(Image image, double a, double b, double c, double d, double e, double f) throws DocumentException
Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y) use addImage(image, image_width, 0, 0, image_height, x, y).
image
- the Image
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
DocumentException
- on error
public void addImage(Image image, AffineTransform transform) throws DocumentException
image
- image to add
transform
- transform to apply to the template prior to adding it.
DocumentException
public void addImage(Image image, float a, float b, float c, float d, float e, float f, boolean inlineImage) throws DocumentException
Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y) use addImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline.
image
- the Image
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
inlineImage
- true
to place this image inline, false
otherwise
DocumentException
- on error
public void addImage(Image image, double a, double b, double c, double d, double e, double f, boolean inlineImage) throws DocumentException
Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y) use addImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline.
image
- the Image
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
inlineImage
- true
to place this image inline, false
otherwise
DocumentException
- on error
protected void addImage(Image image, double a, double b, double c, double d, double e, double f, boolean inlineImage, boolean isMCBlockOpened) throws DocumentException
Image
to the page. The positioning of the Image
is done with the transformation matrix. To position an image
at (x,y) The image can be placed inline.
image
- the Image
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
inlineImage
- true
to place this image inline, false
otherwise
isMCBlockOpened
- true
not to open MCBlock, false
otherwise
DocumentException
- on error
public void reset()
PdfContentByte
empty. Calls reset( true )
public void reset(boolean validateContent)
PdfContentByte
empty.
validateContent
- will call sanityCheck()
if true.
protected void beginText(boolean restoreTM)
restoreTM
- indicates if to restore text matrix of the previous text block.
public void beginText()
public void endText()
public void saveState()
saveState
and restoreState
must be balanced.
public void restoreState()
saveState
and restoreState
must be balanced.
public void setCharacterSpacing(float charSpace)
charSpace
- a parameter
public void setWordSpacing(float wordSpace)
wordSpace
- a parameter
public void setHorizontalScaling(float scale)
scale
- a parameter
public void setLeading(float leading)
The leading parameter is measured in text space units. It specifies the vertical distance between the baselines of adjacent lines of text.
leading
- the new leading
public void setFontAndSize(BaseFont bf, float size)
bf
- the font
size
- the font size in points
public void setTextRenderingMode(int rendering)
rendering
- a parameter
public void setTextRise(float rise)
This allows to write text in subscript or superscript mode.
rise
- a parameter
public void setTextRise(double rise)
This allows to write text in subscript or superscript mode.
rise
- a parameter
public void showText(String text)
text
.
text
- the text to write
public void showTextGid(String gids)
public static PdfTextArray getKernArray(String text, BaseFont font)
text
- the text
font
- the font
public void showTextKerned(String text)
text
kerned.
text
- the text to write
public void newlineShowText(String text)
text
.
text
- the text to write
public void newlineShowText(float wordSpacing, float charSpacing, String text)
wordSpacing
- a parameter
charSpacing
- a parameter
text
- the text to write
public void setTextMatrix(float a, float b, float c, float d, float x, float y)
Remark: this operation also initializes the current point position.
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 void setTextMatrix(AffineTransform transform)
transform
- overwrite the current text matrix with this one
public void setTextMatrix(float x, float y)
Remark: this operation also initializes the current point position.
x
- operand 3,1 in the matrix
y
- operand 3,2 in the matrix
public void moveText(float x, float y)
x
- x-coordinate of the new current point
y
- y-coordinate of the new current point
public void moveTextWithLeading(float x, float y)
As a side effect, this sets the leading parameter in the text state.
x
- offset of the new current point
y
- y-coordinate of the new current point
public void newlineText()
public void addOutline(PdfOutline outline, String name)
outline
- the outline
name
- the name for the local destination
public PdfOutline getRootOutline()
public float getEffectiveStringWidth(String text, boolean kerned)
text
- the string to get width of
kerned
- the kerning option
public void showTextAligned(int alignment, String text, float x, float y, float rotation)
alignment
- the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT
text
- the text to show
x
- the x pivot position
y
- the y pivot position
rotation
- the rotation to be applied in degrees counterclockwise
public void showTextAlignedKerned(int alignment, String text, float x, float y, float rotation)
alignment
- the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT
text
- the text to show
x
- the x pivot position
y
- the y pivot position
rotation
- the rotation to be applied in degrees counterclockwise
public void concatCTM(float a, float b, float c, float d, float e, float f)
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 void concatCTM(double a, double b, double c, double d, double e, double f)
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 void concatCTM(AffineTransform transform)
transform
- added to the Current Transformation Matrix
public static ArrayListbezierArc(float x1, float y1, float x2, float y2, float startAng, float extent)
(x1, y1) and (x2, y2) are the corners of the enclosing rectangle. Angles, measured in degrees, start with 0 to the right (the positive X axis) and increase counter-clockwise. The arc extends from startAng to startAng+extent. I.e. startAng=0 and extent=180 yields an openside-down semi-circle.
The resulting coordinates are of the form float[]{x1,y1,x2,y2,x3,y3, x4,y4} such that the curve goes from (x1, y1) to (x4, y4) with (x2, y2) and (x3, y3) as their respective Bezier control points.
Note: this code was taken from ReportLab (www.reportlab.org), an excellent PDF generator for Python (BSD license: http://www.reportlab.org/devfaq.html#1.3 ).
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 static ArrayListbezierArc(double x1, double y1, double x2, double y2, double startAng, double extent)
(x1, y1) and (x2, y2) are the corners of the enclosing rectangle. Angles, measured in degrees, start with 0 to the right (the positive X axis) and increase counter-clockwise. The arc extends from startAng to startAng+extent. I.e. startAng=0 and extent=180 yields an openside-down semi-circle.
The resulting coordinates are of the form float[]{x1,y1,x2,y2,x3,y3, x4,y4} such that the curve goes from (x1, y1) to (x4, y4) with (x2, y2) and (x3, y3) as their respective Bezier control points.
Note: this code was taken from ReportLab (www.reportlab.org), an excellent PDF generator for Python (BSD license: http://www.reportlab.org/devfaq.html#1.3 ).
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 void arc(float x1, float y1, float x2, float y2, float startAng, float 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 void 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 void ellipse(float x1, float y1, float x2, float 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 void 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 PdfPatternPainter createPattern(float width, float height, float xstep, float ystep)
width
- the width of the pattern
height
- the height of the pattern
xstep
- the desired horizontal spacing between pattern cells. May be either positive or negative, but not zero.
ystep
- the desired vertical spacing between pattern cells. May be either positive or negative, but not zero.
PdfPatternPainter
where the pattern will be created
public PdfPatternPainter createPattern(float width, float height)
width
- the width of the pattern
height
- the height of the pattern
PdfPatternPainter
where the pattern will be created
public PdfPatternPainter createPattern(float width, float height, float xstep, float ystep, BaseColor color)
width
- the width of the pattern
height
- the height of the pattern
xstep
- the desired horizontal spacing between pattern cells. May be either positive or negative, but not zero.
ystep
- the desired vertical spacing between pattern cells. May be either positive or negative, but not zero.
color
- the default color. Can be null
PdfPatternPainter
where the pattern will be created
public PdfPatternPainter createPattern(float width, float height, BaseColor color)
width
- the width of the pattern
height
- the height of the pattern
color
- the default color. Can be null
PdfPatternPainter
where the pattern will be created
public PdfTemplate createTemplate(float width, float height)
Creates a new template that is nothing more than a form XObject. This template can be included in this PdfContentByte
or in another template. Templates are only written to the output when the document is closed permitting things like showing text in the first page that is only defined in the last page.
width
- the bounding box width
height
- the bounding box height
public PdfAppearance createAppearance(float width, float height)
width
- the bounding box width
height
- the bounding box height
public void addPSXObject(PdfPSXObject psobject)
psobject
- the object
public void addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f)
template
- the template
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 void addTemplate(PdfTemplate template, double a, double b, double c, double d, double e, double f)
template
- the template
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 void addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f, boolean tagContent)
template
- the template
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
tagContent
- true
- template content will be tagged(all that will be added after), false
- only a Do operator will be tagged. taken into account only if isTagged()
- true
.
public void addTemplate(PdfTemplate template, double a, double b, double c, double d, double e, double f, boolean tagContent)
template
- the template
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
tagContent
- true
- template content will be tagged(all that will be added after), false
- only a Do operator will be tagged. taken into account only if isTagged()
- true
.
public PdfName addFormXObj(PdfStream formXObj, PdfName name, float a, float b, float c, float d, float e, float f) throws IOException
formXObj
- the form XObject
name
- the name of form XObject in content stream. The name is changed, if if it already exists in page resources
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
name
parameter
IOException
public PdfName addFormXObj(PdfStream formXObj, PdfName name, double a, double b, double c, double d, double e, double f) throws IOException
formXObj
- the form XObject
name
- the name of form XObject in content stream. The name is changed, if if it already exists in page resources
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
name
parameter
IOException
public void addTemplate(PdfTemplate template, AffineTransform transform)
template
- template to add
transform
- transform to apply to the template prior to adding it.
public void addTemplate(PdfTemplate template, AffineTransform transform, boolean tagContent)
template
- template to add
transform
- transform to apply to the template prior to adding it.
tagContent
- true
- template content will be tagged(all that will be added after), false
- only a Do operator will be tagged. taken into account only if isTagged()
- true
.
public void addTemplate(PdfTemplate template, float x, float y)
template
- the template
x
- the x location of this template
y
- the y location of this template
public void addTemplate(PdfTemplate template, double x, double y)
template
- the template
x
- the x location of this template
y
- the y location of this template
public void addTemplate(PdfTemplate template, float x, float y, boolean tagContent)
public void addTemplate(PdfTemplate template, double x, double y, boolean tagContent)
public void setCMYKColorFill(int cyan, int magenta, int yellow, int black)
Sets the color space to DeviceCMYK (or the DefaultCMYK color space), and sets the color to use for filling paths.
This method is described in the 'Portable Document Format Reference Manual version 1.3' section 8.5.2.1 (page 331).
Following the PDF manual, each operand must be a number between 0 (no ink) and 1 (maximum ink). This method however accepts only integers between 0x00 and 0xFF.
cyan
- the intensity of cyan
magenta
- the intensity of magenta
yellow
- the intensity of yellow
black
- the intensity of black
public void setCMYKColorStroke(int cyan, int magenta, int yellow, int black)
Sets the color space to DeviceCMYK (or the DefaultCMYK color space), and sets the color to use for stroking paths.
This method is described in the 'Portable Document Format Reference Manual version 1.3' section 8.5.2.1 (page 331).
Following the PDF manual, each operand must be a number between 0 (minimum intensity) and 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.cyan
- the intensity of red
magenta
- the intensity of green
yellow
- the intensity of blue
black
- the intensity of black
public void setRGBColorFill(int red, int green, int blue)
Sets the color space to DeviceRGB (or the DefaultRGB color space), and sets the color to use for filling paths.
This method is described in the 'Portable Document Format Reference Manual version 1.3' section 8.5.2.1 (page 331).
Following the PDF manual, each operand must be a number between 0 (minimum intensity) and 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.
red
- the intensity of red
green
- the intensity of green
blue
- the intensity of blue
public void setRGBColorStroke(int red, int green, int blue)
Sets the color space to DeviceRGB (or the DefaultRGB color space), and sets the color to use for stroking paths.
This method is described in the 'Portable Document Format Reference Manual version 1.3' section 8.5.2.1 (page 331).
Following the PDF manual, each operand must be a number between 0 (minimum intensity) and 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.red
- the intensity of red
green
- the intensity of green
blue
- the intensity of blue
public void setColorStroke(BaseColor color)
color
can be an ExtendedColor
.
color
- the color
public void setColorFill(BaseColor color)
color
can be an ExtendedColor
.
color
- the color
public void setColorFill(PdfSpotColor sp, float tint)
sp
- the spot color
tint
- the tint for the spot color. 0 is no color and 1 is 100% color
public void setColorFill(PdfDeviceNColor dn, float[] tints)
public void setColorFill(PdfLabColor lab, float l, float a, float b)
public void setColorStroke(PdfSpotColor sp, float tint)
sp
- the spot color
tint
- the tint for the spot color. 0 is no color and 1 is 100% color
public void setColorStroke(PdfDeviceNColor sp, float[] tints)
public void setColorStroke(PdfLabColor lab, float l, float a, float b)
public void setPatternFill(PdfPatternPainter p)
p
- the pattern
public void setPatternFill(PdfPatternPainter p, BaseColor color)
p
- the pattern
color
- the color of the pattern
public void setPatternFill(PdfPatternPainter p, BaseColor color, float tint)
p
- the pattern
color
- the color of the pattern
tint
- the tint if the color is a spot color, ignored otherwise
public void setPatternStroke(PdfPatternPainter p, BaseColor color)
p
- the pattern
color
- the color of the pattern
public void setPatternStroke(PdfPatternPainter p, BaseColor color, float tint)
p
- the pattern
color
- the color of the pattern
tint
- the tint if the color is a spot color, ignored otherwise
public void setPatternStroke(PdfPatternPainter p)
p
- the pattern
public void paintShading(PdfShading shading)
shading
- the shading object
public void paintShading(PdfShadingPattern shading)
shading
- the shading pattern
public void setShadingFill(PdfShadingPattern shading)
shading
- the shading pattern
public void setShadingStroke(PdfShadingPattern shading)
shading
- the shading pattern
protected void checkWriter()
public void showText(PdfTextArray text)
text
- array of text
public PdfWriter getPdfWriter()
PdfWriter
in use by this object.
PdfWriter
in use by this object
public PdfDocument getPdfDocument()
PdfDocument
in use by this object.
PdfDocument
in use by this object
public void localGoto(String name, float llx, float lly, float urx, float ury)
name
- the name for this link
llx
- the lower left x corner of the activation area
lly
- the lower left y corner of the activation area
urx
- the upper right x corner of the activation area
ury
- the upper right y corner of the activation area
public boolean localDestination(String name, PdfDestination destination)
name
- the name of this local destination
destination
- the PdfDestination
with the jump coordinates
true
if the local destination was added, false
if a local destination with the same name already exists
public PdfContentByte getDuplicate()
PdfContentByte
. All the members are copied by reference but the buffer stays different.
PdfContentByte
public PdfContentByte getDuplicate(boolean inheritGraphicState)
public void inheritGraphicState(PdfContentByte parentCanvas)
public void remoteGoto(String filename, String name, float llx, float lly, float urx, float ury)
filename
- the filename for the remote document
name
- the name to jump to
llx
- the lower left x corner of the activation area
lly
- the lower left y corner of the activation area
urx
- the upper right x corner of the activation area
ury
- the upper right y corner of the activation area
public void remoteGoto(String filename, int page, float llx, float lly, float urx, float ury)
filename
- the filename for the remote document
page
- the page to jump to
llx
- the lower left x corner of the activation area
lly
- the lower left y corner of the activation area
urx
- the upper right x corner of the activation area
ury
- the upper right y corner of the activation area
public void roundRectangle(float x, float y, float w, float h, float r)
x
- x-coordinate of the starting point
y
- y-coordinate of the starting point
w
- width
h
- height
r
- radius of the arc corner
public void roundRectangle(double x, double y, double w, double h, double r)
x
- x-coordinate of the starting point
y
- y-coordinate of the starting point
w
- width
h
- height
r
- radius of the arc corner
public void setAction(PdfAction action, float llx, float lly, float urx, float ury)
action
- the PdfAction
llx
- the lower left x corner of the activation area
lly
- the lower left y corner of the activation area
urx
- the upper right x corner of the activation area
ury
- the upper right y corner of the activation area
public void setLiteral(String s)
String
directly to the content.
s
- the String
public void setLiteral(char c)
char
directly to the content.
c
- the char
public void setLiteral(float n)
float
directly to the content.
n
- the float
public void drawRadioField(float llx, float lly, float urx, float ury, boolean on)
llx
-
lly
-
urx
-
ury
-
on
-
public void drawRadioField(double llx, double lly, double urx, double ury, boolean on)
llx
-
lly
-
urx
-
ury
-
on
-
public void drawTextField(float llx, float lly, float urx, float ury)
llx
-
lly
-
urx
-
ury
-
public void drawTextField(double llx, double lly, double urx, double ury)
llx
-
lly
-
urx
-
ury
-
public void drawButton(float llx, float lly, float urx, float ury, String text, BaseFont bf, float size)
llx
-
lly
-
urx
-
ury
-
text
-
bf
-
size
-
public void drawButton(double llx, double lly, double urx, double ury, String text, BaseFont bf, float size)
llx
-
lly
-
urx
-
ury
-
text
-
bf
-
size
-
public void setGState(PdfGState gstate)
gstate
- the graphic state
public void beginLayer(PdfOCG 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
public void endLayer()
public void transform(AffineTransform af)
af
- the transformation
public void addAnnotation(PdfAnnotation annot, boolean applyCTM)
public void setDefaultColorspace(PdfName name, PdfObject obj)
name
- the name of the colorspace. It can be PdfName.DEFAULTGRAY
, PdfName.DEFAULTRGB
or PdfName.DEFAULTCMYK
obj
- the colorspace. A null
or PdfNull
removes any colorspace with the same name
public void beginMarkedContentSequence(PdfStructureElement struc)
struc
. The same structure can be used several times to connect text that belongs to the same logical segment but is in a different location, like the same paragraph crossing to another page, for example.
struc
- the tagging structure
protected PdfIndirectReference getCurrentPage()
public void endMarkedContentSequence()
public void beginMarkedContentSequence(PdfName tag, PdfDictionary property, boolean inline)
null
the mark will be of the type BMC
otherwise it will be BDC
.
tag
- the tag
property
- the property
inline
- true
to include the property in the content or false
to include the property in the resource dictionary with the possibility of reusing
public void beginMarkedContentSequence(PdfName tag)
beginMarkedContentSequence(tag, null, false)
.
tag
- the tag
public void sanityCheck()
IllegalPdfSyntaxException
- (a runtime exception)
public void openMCBlock(IAccessibleElement element)
public void closeMCBlock(IAccessibleElement element)
protected ArrayList<IAccessibleElement> saveMCBlocks()
protected void restoreMCBlocks(ArrayList<IAccessibleElement> mcElements)
protected int getMcDepth()
protected void setMcDepth(int value)
protected ArrayList<IAccessibleElement> getMcElements()
protected void setMcElements(ArrayList<IAccessibleElement> value)
protected void updateTx(String text, float Tj)
protected boolean getInText()
protected void checkState()
public Graphics2D createGraphicsShapes(float width, float height)
Graphics2D
to write on. The graphics are translated to PDF commands as shapes. No PDF fonts will appear.
width
- the width of the panel
height
- the height of the panel
Graphics2D
public Graphics2D createPrinterGraphicsShapes(float width, float height, PrinterJob printerJob)
Graphics2D
to print on. The graphics are translated to PDF commands as shapes. No PDF fonts will appear.
width
- the width of the panel
height
- the height of the panel
printerJob
- a printer job
Graphics2D
public Graphics2D createGraphics(float width, float height)
Graphics2D
to write on. The graphics are translated to PDF commands.
width
- the width of the panel
height
- the height of the panel
Graphics2D
public Graphics2D createPrinterGraphics(float width, float height, PrinterJob printerJob)
Graphics2D
to print on. The graphics are translated to PDF commands.
width
- the width of the panel
height
- the height of the panel
printerJob
-
Graphics2D
public Graphics2D createGraphics(float width, float height, boolean convertImagesToJPEG, float quality)
Graphics2D
to write on. The graphics are translated to PDF commands.
width
- the width of the panel
height
- the height of the panel
convertImagesToJPEG
-
quality
-
Graphics2D
public Graphics2D createPrinterGraphics(float width, float height, boolean convertImagesToJPEG, float quality, PrinterJob printerJob)
Graphics2D
to print on. The graphics are translated to PDF commands.
width
- the width of the panel
height
- the height of the panel
convertImagesToJPEG
-
quality
-
printerJob
-
Graphics2D
public Graphics2D createGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality)
Graphics2D
to print on. The graphics are translated to PDF commands.
width
-
height
-
convertImagesToJPEG
-
quality
-
public Graphics2D createPrinterGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality, PrinterJob printerJob)
Graphics2D
to print on. The graphics are translated to PDF commands.
width
-
height
-
convertImagesToJPEG
-
quality
-
printerJob
-
public Graphics2D createGraphics(float width, float height, FontMapper fontMapper)
Graphics2D
to write on. The graphics are translated to PDF commands.
width
- the width of the panel
height
- the height of the panel
fontMapper
- the mapping from awt fonts to BaseFont
Graphics2D
public Graphics2D createPrinterGraphics(float width, float height, FontMapper fontMapper, PrinterJob printerJob)
Graphics2D
to print on. The graphics are translated to PDF commands.
width
- the width of the panel
height
- the height of the panel
fontMapper
- the mapping from awt fonts to BaseFont
printerJob
- a printer job
Graphics2D
public Graphics2D createGraphics(float width, float height, FontMapper fontMapper, boolean convertImagesToJPEG, float quality)
Graphics2D
to write on. The graphics are translated to PDF commands.
width
- the width of the panel
height
- the height of the panel
fontMapper
- the mapping from awt fonts to BaseFont
convertImagesToJPEG
- converts awt images to jpeg before inserting in pdf
quality
- the quality of the jpeg
Graphics2D
public Graphics2D createPrinterGraphics(float width, float height, FontMapper fontMapper, boolean convertImagesToJPEG, float quality, PrinterJob printerJob)
Graphics2D
to print on. The graphics are translated to PDF commands.
width
- the width of the panel
height
- the height of the panel
fontMapper
- the mapping from awt fonts to BaseFont
convertImagesToJPEG
- converts awt images to jpeg before inserting in pdf
quality
- the quality of the jpeg
printerJob
- a printer job
Graphics2D
public void addImage(Image image, AffineTransform transform) throws DocumentException
image
- image to add
transform
- transform to apply to the template prior to adding it.
DocumentException
public void addTemplate(PdfTemplate template, AffineTransform transform)
template
- template to add
transform
- transform to apply to the template prior to adding it.
public void concatCTM(AffineTransform transform)
transform
- added to the Current Transformation Matrix
public void setTextMatrix(AffineTransform transform)
transform
- overwrite the current text matrix with this one
public void transform(AffineTransform af)
af
- the transformation
Copyright © 1998–2018. All rights reserved.