iText 8.0.5 API
iText.Kernel.Pdf.Canvas.PdfCanvas Class Reference

PdfCanvas class represents an algorithm for writing data into content stream. More...

Inheritance diagram for iText.Kernel.Pdf.Canvas.PdfCanvas:
iText.Kernel.Font.Type3Glyph iText.Kernel.Pdf.Canvas.PdfPatternCanvas

Public Member Functions

  PdfCanvas (PdfStream contentStream, PdfResources resources, PdfDocument document)
  Creates PdfCanvas from content stream of page, form XObject, pattern etc. More...
 
  PdfCanvas (PdfPage page)
  Convenience method for fast PdfCanvas creation by a certain page. More...
 
  PdfCanvas (PdfPage page, bool wrapOldContent)
  Convenience method for fast PdfCanvas creation by a certain page. More...
 
  PdfCanvas (PdfFormXObject xObj, PdfDocument document)
  Creates a PdfCanvas from a PdfFormXObject. More...
 
  PdfCanvas (PdfDocument doc, int pageNum)
  Convenience method for fast PdfCanvas creation by a certain page. More...
 
virtual PdfResources  GetResources ()
  Get the resources of the page that this canvas belongs to.. More...
 
virtual PdfDocument  GetDocument ()
  Get the document this canvas belongs to More...
 
virtual void  AttachContentStream (PdfStream contentStream)
  Attaches new content stream to the canvas. More...
 
virtual CanvasGraphicsState  GetGraphicsState ()
  Gets current CanvasGraphicsState. More...
 
virtual void  Release ()
  Releases the canvas. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SaveState ()
  Saves graphics state. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  RestoreState ()
  Restores graphics state. More...
 
virtual iText.Kernel.Pdf.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. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ConcatMatrix (PdfArray array)
  Concatenates the 2x3 affine transformation matrix to the current matrix in the content stream managed by this Canvas. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ConcatMatrix (AffineTransform transform)
  Concatenates the affine transformation matrix to the current matrix in the content stream managed by this Canvas. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  BeginText ()
  Begins text block (PDF BT operator). More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  EndText ()
  Ends text block (PDF ET operator). More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  BeginVariableText ()
  Begins variable text block More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  EndVariableText ()
  Ends variable text block More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetFontAndSize (PdfFont font, float size)
  Sets font and size (PDF Tf operator). More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  MoveText (double x, double y)
  Moves text by shifting text line matrix (PDF Td operator). More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetLeading (float leading)
  Sets the text leading parameter. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  MoveTextWithLeading (float x, float y)
  Moves to the start of the next line, offset from the start of the current line. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  NewlineText ()
  Moves to the start of the next line. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  NewlineShowText (String text)
  Moves to the next line and shows text . More...
 
virtual iText.Kernel.Pdf.Canvas.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. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetTextRenderingMode (int textRenderingMode)
  Sets text rendering mode. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetTextRise (float textRise)
  Sets the text rise parameter. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetWordSpacing (float wordSpacing)
  Sets the word spacing parameter. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetCharacterSpacing (float charSpacing)
  Sets the character spacing parameter. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetHorizontalScaling (float scale)
  Sets the horizontal scaling parameter. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetTextMatrix (float a, float b, float c, float d, float x, float y)
  Replaces the text matrix. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetTextMatrix (AffineTransform transform)
  Replaces the text matrix. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetTextMatrix (float x, float y)
  Changes the text matrix. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ShowText (String text)
  Shows text (operator Tj). More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ShowText (GlyphLine text)
  Shows text (operator Tj). More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ShowText (GlyphLine text, IEnumerator< GlyphLine.GlyphLinePart > iterator)
  Shows text (operator Tj). More...
 
virtual void  SetDrawingOnPage (bool drawingOnPage)
  Sets whether we are currently drawing on a page. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ShowText (PdfArray textArray)
  Shows text (operator TJ) More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  MoveTo (double x, double y)
  Move the current point (x, y), omitting any connecting line segment. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  LineTo (double x, double y)
  Appends a straight line segment from the current point (x, y). More...
 
virtual iText.Kernel.Pdf.Canvas.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. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  CurveTo (double x2, double y2, double x3, double y3)
  Appends a Bezier curve to the path, starting from the current point. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  CurveFromTo (double x1, double y1, double x3, double y3)
  Appends a Bezier curve to the path, starting from the current point. More...
 
virtual iText.Kernel.Pdf.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. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ArcContinuous (double x1, double y1, double x2, double y2, double startAng, double extent)
  Draws a partial ellipse with the preceding line to the start of the arc to prevent path broking. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  Ellipse (double x1, double y1, double x2, double y2)
  Draws an ellipse inscribed within the rectangle x1,y1,x2,y2. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  Rectangle (double x, double y, double width, double height)
  Draws a rectangle. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  Rectangle (iText.Kernel.Geom.Rectangle rectangle)
  Draws a rectangle. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  RoundRectangle (double x, double y, double width, double height, double radius)
  Draws rounded rectangle. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  Circle (double x, double y, double r)
  Draws a circle. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  PaintShading (PdfShading shading)
  Paints a shading object and adds it to the resources of this canvas More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ClosePath ()
  Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ClosePathEoFillStroke ()
  Closes the path, fills it using the even-odd rule to determine the region to fill and strokes it. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ClosePathFillStroke ()
  Closes the path, fills it using the non-zero winding number rule to determine the region to fill and strokes it. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  EndPath ()
  Ends the path without filling or stroking it. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  Stroke ()
  Strokes the path. More...
 
virtual iText.Kernel.Pdf.Canvas.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. More...
 
virtual iText.Kernel.Pdf.Canvas.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. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ClosePathStroke ()
  Closes the path and strokes it. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  Fill ()
  Fills current path. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  FillStroke ()
  Fills the path using the non-zero winding number rule to determine the region to fill and strokes it. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  EoFill ()
  EOFills current path. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  EoFillStroke ()
  Fills the path, using the even-odd rule to determine the region to fill and strokes it. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetLineWidth (float lineWidth)
  Sets line width. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetLineCapStyle (int lineCapStyle)
  Sets the line cap style, the shape to be used at the ends of open subpaths when they are stroked. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetLineJoinStyle (int lineJoinStyle)
  Sets the line join style, the shape to be used at the corners of paths when they are stroked. More...
 
virtual iText.Kernel.Pdf.Canvas.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. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetLineDash (float phase)
  Changes the value of the line dash pattern. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetLineDash (float unitsOn, float phase)
  Changes the value of the line dash pattern. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetLineDash (float unitsOn, float unitsOff, float phase)
  Changes the value of the line dash pattern. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetLineDash (float[] array, float phase)
  Changes the value of the line dash pattern. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetRenderingIntent (PdfName renderingIntent)
  Set the rendering intent. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetFlatnessTolerance (float flatnessTolerance)
  Changes the Flatness. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetFillColor (Color color)
  Changes the current color for filling paths. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetStrokeColor (Color color)
  Changes the current color for stroking paths. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetColor (Color color, bool fill)
  Changes the current color for paths. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetColor (PdfColorSpace colorSpace, float[] colorValue, bool fill)
  Changes the current color for paths. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetColor (PdfColorSpace colorSpace, float[] colorValue, PdfPattern pattern, bool fill)
  Changes the current color for paths with an explicitly defined pattern. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetFillColorGray (float g)
  Changes the current color for filling paths to a grayscale value. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetStrokeColorGray (float g)
  Changes the current color for stroking paths to a grayscale value. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ResetFillColorGray ()
  Changes the current color for filling paths to black. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ResetStrokeColorGray ()
  Changes the current color for stroking paths to black. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetFillColorRgb (float r, float g, float b)
  Changes the current color for filling paths to an RGB value. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetStrokeColorRgb (float r, float g, float b)
  Changes the current color for stroking paths to an RGB value. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetFillColorShading (PdfPattern.Shading shading)
  Adds or changes the shading of the current fill color path. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetStrokeColorShading (PdfPattern.Shading shading)
  Adds or changes the shading of the current stroke color path. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ResetFillColorRgb ()
  Changes the current color for filling paths to black. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ResetStrokeColorRgb ()
  Changes the current color for stroking paths to black. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetFillColorCmyk (float c, float m, float y, float k)
  Changes the current color for filling paths to a CMYK value. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetStrokeColorCmyk (float c, float m, float y, float k)
  Changes the current color for stroking paths to a CMYK value. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ResetFillColorCmyk ()
  Changes the current color for filling paths to black. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  ResetStrokeColorCmyk ()
  Changes the current color for stroking paths to black. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  BeginLayer (IPdfOCG layer)
  Begins a graphic block whose visibility is controlled by the layer. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  EndLayer ()
  Ends OCG layer. More...
 
virtual PdfXObject  AddImageWithTransformationMatrix (ImageData image, float a, float b, float c, float d, float e, float f)
  Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and adds it to canvas. More...
 
virtual PdfXObject  AddImageWithTransformationMatrix (ImageData image, float a, float b, float c, float d, float e, float f, bool asInline)
  Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and adds it to canvas. More...
 
virtual PdfXObject  AddImageFittedIntoRectangle (ImageData image, iText.Kernel.Geom.Rectangle rect, bool asInline)
  Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and fitted into specific rectangle on canvas. More...
 
virtual PdfXObject  AddImageAt (ImageData image, float x, float y, bool asInline)
  Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and adds it to the specified position. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  AddXObjectWithTransformationMatrix (PdfXObject xObject, float a, float b, float c, float d, float e, float f)
  Adds iText.Kernel.Pdf.Xobject.PdfXObject to canvas. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  AddXObjectAt (PdfXObject xObject, float x, float y)
  Adds iText.Kernel.Pdf.Xobject.PdfXObject to the specified position. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  AddXObjectFittedIntoRectangle (PdfXObject xObject, iText.Kernel.Geom.Rectangle rect)
  Adds iText.Kernel.Pdf.Xobject.PdfXObject fitted into specific rectangle on canvas. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  AddXObject (PdfXObject xObject)
  Adds iText.Kernel.Pdf.Xobject.PdfXObject on canvas. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  SetExtGState (PdfExtGState extGState)
  Sets the ExtGState dictionary for the current graphics state More...
 
virtual PdfExtGState  SetExtGState (PdfDictionary extGState)
  Sets the ExtGState dictionary for the current graphics state More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  BeginMarkedContent (PdfName tag)
  Manually start a Marked Content sequence. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  BeginMarkedContent (PdfName tag, PdfDictionary properties)
  Manually start a Marked Content sequence with properties. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  EndMarkedContent ()
  Manually end a Marked Content sequence. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  OpenTag (CanvasTag tag)
  Manually open a canvas tag, beginning a Marked Content sequence. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  OpenTag (TagReference tagReference)
  Open a tag, beginning a Marked Content sequence. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  CloseTag ()
  Manually close a tag, ending a Marked Content sequence. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  WriteLiteral (String s)
  Outputs a String directly to the content. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  WriteLiteral (char c)
  Outputs a char directly to the content. More...
 
virtual iText.Kernel.Pdf.Canvas.PdfCanvas  WriteLiteral (float n)
  Outputs a float directly to the content. More...
 
virtual PdfStream  GetContentStream ()
  Please, use this method with caution and only if you know what you are doing. More...
 

Static Public Member Functions

static IList< double[]>  BezierArc (double x1, double y1, double x2, double y2, double startAng, double extent)
  Generates an array of bezier curves to draw an arc. More...
 

Package Functions

virtual void  AddInlineImage (PdfImageXObject imageXObject, float a, float b, float c, float d, float e, float f)
  Adds PdfImageXObject to canvas. More...
 

Package Attributes

Stack< CanvasGraphicsState gsStack = new Stack<CanvasGraphicsState>()
  a LIFO stack of graphics state saved states. More...
 
CanvasGraphicsState  currentGs = new CanvasGraphicsState()
  the current graphics state. More...
 
PdfStream  contentStream
  the content stream for this canvas object. More...
 
PdfResources  resources
  the resources for the page that this canvas belongs to. More...
 
PdfDocument  document
  the document that the resulting content stream of this canvas will be written to. More...
 
int  mcDepth
  a counter variable for the marked content stack. More...
 
IList< int >  layerDepth
  The list where we save/restore the layer depth. More...
 
bool  drawingOnPage = false
 

Detailed Description

PdfCanvas class represents an algorithm for writing data into content stream.

PdfCanvas class represents an algorithm for writing data into content stream. To write into page content, create PdfCanvas from a page instance. To write into form XObject, create PdfCanvas from a form XObject instance. Make sure to call PdfCanvas.release() after you finished writing to the canvas. It will save some memory.

Constructor & Destructor Documentation

◆ PdfCanvas() [1/5]

iText.Kernel.Pdf.Canvas.PdfCanvas.PdfCanvas ( PdfStream  contentStream,
PdfResources  resources,
PdfDocument  document 
)
inline

Creates PdfCanvas from content stream of page, form XObject, pattern etc.

Parameters
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

◆ PdfCanvas() [2/5]

iText.Kernel.Pdf.Canvas.PdfCanvas.PdfCanvas ( PdfPage  page )
inline

Convenience method for fast PdfCanvas creation by a certain page.

Parameters
page page to create canvas from.

◆ PdfCanvas() [3/5]

iText.Kernel.Pdf.Canvas.PdfCanvas.PdfCanvas ( PdfPage  page,
bool  wrapOldContent 
)
inline

Convenience method for fast PdfCanvas creation by a certain page.

Parameters
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

◆ PdfCanvas() [4/5]

iText.Kernel.Pdf.Canvas.PdfCanvas.PdfCanvas ( PdfFormXObject  xObj,
PdfDocument  document 
)
inline

Creates a PdfCanvas from a PdfFormXObject.

Parameters
xObj the PdfFormXObject used to create the PdfCanvas
document the document to which the resulting content stream will be written

◆ PdfCanvas() [5/5]

iText.Kernel.Pdf.Canvas.PdfCanvas.PdfCanvas ( PdfDocument  doc,
int  pageNum 
)
inline

Convenience method for fast PdfCanvas creation by a certain page.

Parameters
doc The document
pageNum The page number

Member Function Documentation

◆ AddImageAt()

virtual PdfXObject iText.Kernel.Pdf.Canvas.PdfCanvas.AddImageAt ( ImageData  image,
float  x,
float  y,
bool  asInline 
)
inlinevirtual

Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and adds it to the specified position.

Parameters
image the image from which iText.Kernel.Pdf.Xobject.PdfImageXObject will be created
x the horizontal position of the imageXObject
y the vertical position of the imageXObject
asInline true if to add image as in-line
Returns
the created imageXObject or null in case of in-line image (asInline = true)

◆ AddImageFittedIntoRectangle()

virtual PdfXObject iText.Kernel.Pdf.Canvas.PdfCanvas.AddImageFittedIntoRectangle ( ImageData  image,
iText.Kernel.Geom.Rectangle  rect,
bool  asInline 
)
inlinevirtual

Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and fitted into specific rectangle on canvas.

Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and fitted into specific rectangle on canvas. The created imageXObject will be fit inside on the specified rectangle without preserving aspect ratio.

The x, y, width and height parameters of the rectangle will be used in concatenating the transformation matrix as operands.

Parameters
image the image from which iText.Kernel.Pdf.Xobject.PdfImageXObject will be created
rect the rectangle in which the created imageXObject will be fit
asInline true if to add image as in-line
Returns
the created imageXObject or null in case of in-line image (asInline = true)
See also
ConcatMatrix(double, double, double, double, double, double), iText.Kernel.Pdf.Xobject.PdfXObject.CalculateProportionallyFitRectangleWithWidth(iText.Kernel.Pdf.Xobject.PdfXObject, float, float, float) , iText.Kernel.Pdf.Xobject.PdfXObject.CalculateProportionallyFitRectangleWithHeight(iText.Kernel.Pdf.Xobject.PdfXObject, float, float, float)

◆ AddImageWithTransformationMatrix() [1/2]

virtual PdfXObject iText.Kernel.Pdf.Canvas.PdfCanvas.AddImageWithTransformationMatrix ( ImageData  image,
float  a,
float  b,
float  c,
float  d,
float  e,
float  f 
)
inlinevirtual

Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and adds it to canvas.

Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and adds it to canvas.

The float arguments will be used in concatenating the transformation matrix as operands.

Parameters
image the image from which iText.Kernel.Pdf.Xobject.PdfImageXObject will be created
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
Returns
the created imageXObject or null in case of in-line image (asInline = true)
See also
ConcatMatrix(double, double, double, double, double, double)

◆ AddImageWithTransformationMatrix() [2/2]

virtual PdfXObject iText.Kernel.Pdf.Canvas.PdfCanvas.AddImageWithTransformationMatrix ( ImageData  image,
float  a,
float  b,
float  c,
float  d,
float  e,
float  f,
bool  asInline 
)
inlinevirtual

Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and adds it to canvas.

Creates iText.Kernel.Pdf.Xobject.PdfImageXObject from image and adds it to canvas.

The float arguments will be used in concatenating the transformation matrix as operands.

Parameters
image the image from which iText.Kernel.Pdf.Xobject.PdfImageXObject will be created
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
Returns
the created imageXObject or null in case of in-line image (asInline = true)
See also
ConcatMatrix(double, double, double, double, double, double)

Reimplemented in iText.Kernel.Font.Type3Glyph.

◆ AddInlineImage()

virtual void iText.Kernel.Pdf.Canvas.PdfCanvas.AddInlineImage ( PdfImageXObject  imageXObject,
float  a,
float  b,
float  c,
float  d,
float  e,
float  f 
)
inlinepackagevirtual

Adds PdfImageXObject to canvas.

Parameters
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

◆ AddXObject()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.AddXObject ( PdfXObject  xObject )
inlinevirtual

Adds iText.Kernel.Pdf.Xobject.PdfXObject on canvas.

Adds iText.Kernel.Pdf.Xobject.PdfXObject on canvas.

Note: the iText.Kernel.Pdf.Xobject.PdfImageXObject will be placed at coordinates (0, 0) with its original width and height, the iText.Kernel.Pdf.Xobject.PdfFormXObject will be fitted in its bBox.

Parameters
xObject the xObject to add
Returns
the current canvas

◆ AddXObjectAt()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.AddXObjectAt ( PdfXObject  xObject,
float  x,
float  y 
)
inlinevirtual

Adds iText.Kernel.Pdf.Xobject.PdfXObject to the specified position.

Parameters
xObject the xObject to add
x the horizontal position of the xObject
y the vertical position of the xObject
Returns
the current canvas

◆ AddXObjectFittedIntoRectangle()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.AddXObjectFittedIntoRectangle ( PdfXObject  xObject,
iText.Kernel.Geom.Rectangle  rect 
)
inlinevirtual

Adds iText.Kernel.Pdf.Xobject.PdfXObject fitted into specific rectangle on canvas.

Parameters
xObject the xObject to add
rect the rectangle in which the xObject will be fitted
Returns
the current canvas
See also
iText.Kernel.Pdf.Xobject.PdfXObject.CalculateProportionallyFitRectangleWithWidth(iText.Kernel.Pdf.Xobject.PdfXObject, float, float, float) , iText.Kernel.Pdf.Xobject.PdfXObject.CalculateProportionallyFitRectangleWithHeight(iText.Kernel.Pdf.Xobject.PdfXObject, float, float, float)

◆ AddXObjectWithTransformationMatrix()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.AddXObjectWithTransformationMatrix ( PdfXObject  xObject,
float  a,
float  b,
float  c,
float  d,
float  e,
float  f 
)
inlinevirtual

Adds iText.Kernel.Pdf.Xobject.PdfXObject to canvas.

Adds iText.Kernel.Pdf.Xobject.PdfXObject to canvas.

The float arguments will be used in concatenating the transformation matrix as operands.

Parameters
xObject the xObject to add
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
Returns
the current canvas
See also
ConcatMatrix(double, double, double, double, double, double)

◆ Arc()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.Arc ( double  x1,
double  y1,
double  x2,
double  y2,
double  startAng,
double  extent 
)
inlinevirtual

Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2, starting at startAng degrees and covering extent degrees.

Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2, starting at startAng degrees and covering extent degrees. Angles start with 0 to the right (+x) and increase counter-clockwise.

Parameters
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.
Returns
current canvas.

◆ ArcContinuous()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ArcContinuous ( double  x1,
double  y1,
double  x2,
double  y2,
double  startAng,
double  extent 
)
inlinevirtual

Draws a partial ellipse with the preceding line to the start of the arc to prevent path broking.

Draws a partial ellipse with the preceding line to the start of the arc to prevent path broking. The target arc is inscribed within the rectangle x1,y1,x2,y2, starting at startAng degrees and covering extent degrees. Angles start with 0 to the right (+x) and increase counter-clockwise.

Parameters
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
Returns
the current canvas

◆ AttachContentStream()

virtual void iText.Kernel.Pdf.Canvas.PdfCanvas.AttachContentStream ( PdfStream  contentStream )
inlinevirtual

Attaches new content stream to the canvas.

Attaches new content stream to the canvas. This method is supposed to be used when you want to write in different PdfStream keeping context (gsStack, currentGs, ...) the same.

Parameters
contentStream a content stream to attach.

◆ BeginLayer()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.BeginLayer ( IPdfOCG  layer )
inlinevirtual

Begins a graphic block whose visibility is controlled by the layer.

Begins a graphic block whose visibility is controlled by the layer. Blocks can be nested. Each block must be terminated by an EndLayer() .

Note that nested layers with iText.Kernel.Pdf.Layer.PdfLayer.AddChild(iText.Kernel.Pdf.Layer.PdfLayer) only require a single call to this method and a single call to EndLayer() ; all the nesting control is built in.

Parameters
layer The layer to begin
Returns
The edited canvas.

◆ BeginMarkedContent() [1/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.BeginMarkedContent ( PdfName  tag )
inlinevirtual

Manually start a Marked Content sequence.

Manually start a Marked Content sequence. Used primarily for Tagged PDF

Parameters
tag the type of content contained
Returns
current canvas

◆ BeginMarkedContent() [2/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.BeginMarkedContent ( PdfName  tag,
PdfDictionary  properties 
)
inlinevirtual

Manually start a Marked Content sequence with properties.

Manually start a Marked Content sequence with properties. Used primarily for Tagged PDF

Parameters
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
Returns
current canvas

◆ BeginText()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.BeginText ( )
inlinevirtual

Begins text block (PDF BT operator).

Returns
current canvas.

◆ BeginVariableText()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.BeginVariableText ( )
inlinevirtual

Begins variable text block

Returns
current canvas

◆ BezierArc()

static IList iText.Kernel.Pdf.Canvas.PdfCanvas.BezierArc ( double  x1,
double  y1,
double  x2,
double  y2,
double  startAng,
double  extent 
)
inlinestatic

Generates an array of bezier curves to draw an arc.

Generates an array of bezier curves to draw an arc.
(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 double[]{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 ).

Parameters
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.
Returns
a list of double[] with the bezier curves.

◆ Circle()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.Circle ( double  x,
double  y,
double  r 
)
inlinevirtual

Draws a circle.

Draws a circle. The endpoint will (x+r, y).

Parameters
x x center of circle.
y y center of circle.
r radius of circle.
Returns
current canvas.

◆ Clip()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.Clip ( )
inlinevirtual

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.

Returns
current canvas.

◆ ClosePath()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ClosePath ( )
inlinevirtual

Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath.

Returns
current canvas.

◆ ClosePathEoFillStroke()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ClosePathEoFillStroke ( )
inlinevirtual

Closes the path, fills it using the even-odd rule to determine the region to fill and strokes it.

Returns
current canvas.

◆ ClosePathFillStroke()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ClosePathFillStroke ( )
inlinevirtual

Closes the path, fills it using the non-zero winding number rule to determine the region to fill and strokes it.

Returns
current canvas.

◆ ClosePathStroke()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ClosePathStroke ( )
inlinevirtual

Closes the path and strokes it.

Returns
current canvas.

◆ CloseTag()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.CloseTag ( )
inlinevirtual

Manually close a tag, ending a Marked Content sequence.

Manually close a tag, ending a Marked Content sequence. Used primarily for Tagged PDF

Returns
current canvas

◆ ConcatMatrix() [1/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ConcatMatrix ( AffineTransform  transform )
inlinevirtual

Concatenates the affine transformation matrix to the current matrix in the content stream managed by this Canvas.

Parameters
transform affine transformation matrix to be concatenated to the current matrix
Returns
current canvas
See also
ConcatMatrix(double, double, double, double, double, double)

◆ ConcatMatrix() [2/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ConcatMatrix ( double  a,
double  b,
double  c,
double  d,
double  e,
double  f 
)
inlinevirtual

Concatenates the 2x3 affine transformation matrix to the current matrix in the content stream managed by this Canvas.

Concatenates the 2x3 affine transformation matrix to the current matrix in the content stream managed by this Canvas. Contrast with SetTextMatrix(iText.Kernel.Geom.AffineTransform)

Parameters
a operand 1,1 in the matrix.
b operand 1,2 in the matrix.
c operand 2,1 in the matrix.
d operand 2,2 in the matrix.
e operand 3,1 in the matrix.
f operand 3,2 in the matrix.
Returns
current canvas

◆ ConcatMatrix() [3/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ConcatMatrix ( PdfArray  array )
inlinevirtual

Concatenates the 2x3 affine transformation matrix to the current matrix in the content stream managed by this Canvas.

Concatenates the 2x3 affine transformation matrix to the current matrix in the content stream managed by this Canvas. If an array not containing the 6 values of the matrix is passed, The current canvas is returned unchanged.

Parameters
array affine transformation stored as a PdfArray with 6 values
Returns
current canvas

◆ CurveFromTo()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.CurveFromTo ( double  x1,
double  y1,
double  x3,
double  y3 
)
inlinevirtual

Appends a Bezier curve to the path, starting from the current point.

Parameters
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.
Returns
current canvas.

◆ CurveTo() [1/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.CurveTo ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)
inlinevirtual

Appends a Bêzier curve to the path, starting from the current point.

Parameters
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.
Returns
current canvas.

◆ CurveTo() [2/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.CurveTo ( double  x2,
double  y2,
double  x3,
double  y3 
)
inlinevirtual

Appends a Bezier curve to the path, starting from the current point.

Parameters
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.
Returns
current canvas.

◆ Ellipse()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.Ellipse ( double  x1,
double  y1,
double  x2,
double  y2 
)
inlinevirtual

Draws an ellipse inscribed within the rectangle x1,y1,x2,y2.

Parameters
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
Returns
current canvas.

◆ EndLayer()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.EndLayer ( )
inlinevirtual

Ends OCG layer.

Returns
current canvas.

◆ EndMarkedContent()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.EndMarkedContent ( )
inlinevirtual

Manually end a Marked Content sequence.

Manually end a Marked Content sequence. Used primarily for Tagged PDF

Returns
current canvas

◆ EndPath()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.EndPath ( )
inlinevirtual

Ends the path without filling or stroking it.

Returns
current canvas.

◆ EndText()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.EndText ( )
inlinevirtual

Ends text block (PDF ET operator).

Returns
current canvas.

◆ EndVariableText()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.EndVariableText ( )
inlinevirtual

Ends variable text block

Returns
current canvas

◆ EoClip()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.EoClip ( )
inlinevirtual

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.

Returns
current canvas.

◆ EoFill()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.EoFill ( )
inlinevirtual

EOFills current path.

Returns
current canvas.

◆ EoFillStroke()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.EoFillStroke ( )
inlinevirtual

Fills the path, using the even-odd rule to determine the region to fill and strokes it.

Returns
current canvas.

◆ Fill()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.Fill ( )
inlinevirtual

Fills current path.

Returns
current canvas.

◆ FillStroke()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.FillStroke ( )
inlinevirtual

Fills the path using the non-zero winding number rule to determine the region to fill and strokes it.

Returns
current canvas.

◆ GetContentStream()

virtual PdfStream iText.Kernel.Pdf.Canvas.PdfCanvas.GetContentStream ( )
inlinevirtual

Please, use this method with caution and only if you know what you are doing.

Please, use this method with caution and only if you know what you are doing. Manipulating with underlying stream object of canvas could lead to corruption of it's data.

Returns
the content stream to which this canvas object writes.

◆ GetDocument()

virtual PdfDocument iText.Kernel.Pdf.Canvas.PdfCanvas.GetDocument ( )
inlinevirtual

Get the document this canvas belongs to

Returns
PdfDocument the document that this canvas belongs to

◆ GetGraphicsState()

virtual CanvasGraphicsState iText.Kernel.Pdf.Canvas.PdfCanvas.GetGraphicsState ( )
inlinevirtual

Gets current CanvasGraphicsState.

Returns
container containing properties for the current state of the canvas.

◆ GetResources()

virtual PdfResources iText.Kernel.Pdf.Canvas.PdfCanvas.GetResources ( )
inlinevirtual

Get the resources of the page that this canvas belongs to..

Returns
PdfResources of the page that this canvas belongs to..

◆ LineTo()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.LineTo ( double  x,
double  y 
)
inlinevirtual

Appends a straight line segment from the current point (x, y).

Appends a straight line segment from the current point (x, y). The new current point is (x, y).

Parameters
x x coordinate.
y y coordinate.
Returns
current canvas.

◆ MoveText()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.MoveText ( double  x,
double  y 
)
inlinevirtual

Moves text by shifting text line matrix (PDF Td operator).

Parameters
x x coordinate.
y y coordinate.
Returns
current canvas.

◆ MoveTextWithLeading()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.MoveTextWithLeading ( float  x,
float  y 
)
inlinevirtual

Moves to the start of the next line, offset from the start of the current line.

Moves to the start of the next line, offset from the start of the current line.
As a side effect, this sets the leading parameter in the text state.

Parameters
x offset of the new current point
y y-coordinate of the new current point
Returns
current canvas.

◆ MoveTo()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.MoveTo ( double  x,
double  y 
)
inlinevirtual

Move the current point (x, y), omitting any connecting line segment.

Parameters
x x coordinate.
y y coordinate.
Returns
current canvas.

◆ NewlineShowText() [1/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.NewlineShowText ( float  wordSpacing,
float  charSpacing,
String  text 
)
inlinevirtual

Moves to the next line and shows text string, using the given values of the character and word spacing parameters.

Parameters
wordSpacing a parameter
charSpacing a parameter
text the text to write
Returns
current canvas.

◆ NewlineShowText() [2/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.NewlineShowText ( String  text )
inlinevirtual

Moves to the next line and shows text .

Parameters
text the text to write
Returns
current canvas.

◆ NewlineText()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.NewlineText ( )
inlinevirtual

Moves to the start of the next line.

Returns
current canvas.

◆ OpenTag() [1/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.OpenTag ( CanvasTag  tag )
inlinevirtual

Manually open a canvas tag, beginning a Marked Content sequence.

Manually open a canvas tag, beginning a Marked Content sequence. Used primarily for Tagged PDF

Parameters
tag the type of content that will be contained
Returns
current canvas

◆ OpenTag() [2/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.OpenTag ( TagReference  tagReference )
inlinevirtual

Open a tag, beginning a Marked Content sequence.

Open a tag, beginning a Marked Content sequence. This MC sequence will belong to the tag from the document logical structure.
CanvasTag will be automatically created with assigned mcid(Marked Content id) to it. Mcid serves as a reference between Marked Content sequence and logical structure element.

Parameters
tagReference reference to the tag from the document logical structure
Returns
current canvas

◆ PaintShading()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.PaintShading ( PdfShading  shading )
inlinevirtual

Paints a shading object and adds it to the resources of this canvas

Parameters
shading a shading object to be painted
Returns
current canvas.

◆ Rectangle() [1/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.Rectangle ( double  x,
double  y,
double  width,
double  height 
)
inlinevirtual

Draws a rectangle.

Parameters
x x coordinate of the starting point.
y y coordinate of the starting point.
width width.
height height.
Returns
current canvas.

◆ Rectangle() [2/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.Rectangle ( iText.Kernel.Geom.Rectangle  rectangle )
inlinevirtual

Draws a rectangle.

Parameters
rectangle a rectangle to be drawn
Returns
current canvas.

◆ Release()

virtual void iText.Kernel.Pdf.Canvas.PdfCanvas.Release ( )
inlinevirtual

Releases the canvas.

Releases the canvas. Use this method after you finished working with canvas.

◆ ResetFillColorCmyk()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ResetFillColorCmyk ( )
inlinevirtual

Changes the current color for filling paths to black.

Returns
current canvas.

◆ ResetFillColorGray()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ResetFillColorGray ( )
inlinevirtual

Changes the current color for filling paths to black.

Returns
current canvas.

◆ ResetFillColorRgb()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ResetFillColorRgb ( )
inlinevirtual

Changes the current color for filling paths to black.

Returns
current canvas.

◆ ResetStrokeColorCmyk()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ResetStrokeColorCmyk ( )
inlinevirtual

Changes the current color for stroking paths to black.

Returns
current canvas.

◆ ResetStrokeColorGray()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ResetStrokeColorGray ( )
inlinevirtual

Changes the current color for stroking paths to black.

Returns
current canvas.

◆ ResetStrokeColorRgb()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ResetStrokeColorRgb ( )
inlinevirtual

Changes the current color for stroking paths to black.

Returns
current canvas.

◆ RestoreState()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.RestoreState ( )
inlinevirtual

Restores graphics state.

Returns
current canvas.

◆ RoundRectangle()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.RoundRectangle ( double  x,
double  y,
double  width,
double  height,
double  radius 
)
inlinevirtual

Draws rounded rectangle.

Parameters
x x coordinate of the starting point.
y y coordinate of the starting point.
width width.
height height.
radius radius of the arc corner.
Returns
current canvas.

◆ SaveState()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SaveState ( )
inlinevirtual

Saves graphics state.

Returns
current canvas.

◆ SetCharacterSpacing()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetCharacterSpacing ( float  charSpacing )
inlinevirtual

Sets the character spacing parameter.

Parameters
charSpacing a parameter
Returns
current canvas.

◆ SetColor() [1/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetColor ( Color  color,
bool  fill 
)
inlinevirtual

Changes the current color for paths.

Parameters
color the new color.
fill set fill color (true) or stroke color (false)
Returns
current canvas.

◆ SetColor() [2/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetColor ( PdfColorSpace  colorSpace,
float[]  colorValue,
bool  fill 
)
inlinevirtual

Changes the current color for paths.

Parameters
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)
Returns
current canvas.

◆ SetColor() [3/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetColor ( PdfColorSpace  colorSpace,
float[]  colorValue,
PdfPattern  pattern,
bool  fill 
)
inlinevirtual

Changes the current color for paths with an explicitly defined pattern.

Parameters
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)
Returns
current canvas.

Reimplemented in iText.Kernel.Pdf.Canvas.PdfPatternCanvas.

◆ SetDrawingOnPage()

virtual void iText.Kernel.Pdf.Canvas.PdfCanvas.SetDrawingOnPage ( bool  drawingOnPage )
inlinevirtual

Sets whether we are currently drawing on a page.

Parameters
drawingOnPage

true if we are currently drawing on page false if not

◆ SetExtGState() [1/2]

virtual PdfExtGState iText.Kernel.Pdf.Canvas.PdfCanvas.SetExtGState ( PdfDictionary  extGState )
inlinevirtual

Sets the ExtGState dictionary for the current graphics state

Parameters
extGState a dictionary that maps resource names to graphics state parameter dictionaries
Returns
current canvas.

◆ SetExtGState() [2/2]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetExtGState ( PdfExtGState  extGState )
inlinevirtual

Sets the ExtGState dictionary for the current graphics state

Parameters
extGState a dictionary that maps resource names to graphics state parameter dictionaries
Returns
current canvas.

◆ SetFillColor()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetFillColor ( Color  color )
inlinevirtual

Changes the current color for filling paths.

Parameters
color fill color.
Returns
current canvas.

◆ SetFillColorCmyk()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetFillColorCmyk ( float  c,
float  m,
float  y,
float  k 
)
inlinevirtual

Changes the current color for filling paths to a CMYK value.

Parameters
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]
Returns
current canvas.

◆ SetFillColorGray()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetFillColorGray ( float  g )
inlinevirtual

Changes the current color for filling paths to a grayscale value.

Parameters
g a grayscale value in the range [0,1]
Returns
current canvas.

◆ SetFillColorRgb()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetFillColorRgb ( float  r,
float  g,
float  b 
)
inlinevirtual

Changes the current color for filling paths to an RGB value.

Parameters
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]
Returns
current canvas.

◆ SetFillColorShading()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetFillColorShading ( PdfPattern.Shading  shading )
inlinevirtual

Adds or changes the shading of the current fill color path.

Parameters
shading the shading
Returns
current canvas.

◆ SetFlatnessTolerance()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetFlatnessTolerance ( float  flatnessTolerance )
inlinevirtual

Changes the Flatness.

Changes the Flatness.

Flatness sets the maximum permitted distance in device pixels between the mathematically correct path and an approximation constructed from straight line segments.

Parameters
flatnessTolerance a value
Returns
current canvas.

◆ SetFontAndSize()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetFontAndSize ( PdfFont  font,
float  size 
)
inlinevirtual

Sets font and size (PDF Tf operator).

Parameters
font The font
size The font size.
Returns
The edited canvas.

◆ SetHorizontalScaling()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetHorizontalScaling ( float  scale )
inlinevirtual

Sets the horizontal scaling parameter.

Parameters
scale a parameter.
Returns
current canvas.

◆ SetLeading()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetLeading ( float  leading )
inlinevirtual

Sets the text leading parameter.

Sets the text leading parameter.
The leading parameter is measured in text space units. It specifies the vertical distance between the baselines of adjacent lines of text.

Parameters
leading the new leading.
Returns
current canvas.

◆ SetLineCapStyle()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetLineCapStyle ( int  lineCapStyle )
inlinevirtual

Sets the line cap style, the shape to be used at the ends of open subpaths when they are stroked.

Parameters
lineCapStyle a line cap style to be set
Returns
current canvas.
See also
LineCapStyle

for possible values.

◆ SetLineDash() [1/4]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetLineDash ( float  phase )
inlinevirtual

Changes the value of the line dash pattern.

Changes the value of the line dash pattern.
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.

Parameters
phase the value of the phase
Returns
current canvas.

◆ SetLineDash() [2/4]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetLineDash ( float  unitsOn,
float  phase 
)
inlinevirtual

Changes the value of the line dash pattern.

Changes the value of the line dash pattern.
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.

Parameters
phase the value of the phase
unitsOn the number of units that must be 'on' (equals the number of units that must be 'off').
Returns
current canvas.

◆ SetLineDash() [3/4]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetLineDash ( float  unitsOn,
float  unitsOff,
float  phase 
)
inlinevirtual

Changes the value of the line dash pattern.

Changes the value of the line dash pattern.
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.

Parameters
phase the value of the phase
unitsOn the number of units that must be 'on'
unitsOff the number of units that must be 'off'
Returns
current canvas.

◆ SetLineDash() [4/4]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetLineDash ( float[]  array,
float  phase 
)
inlinevirtual

Changes the value of the line dash pattern.

Changes the value of the line dash pattern.
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.

Parameters
array length of the alternating dashes and gaps
phase the value of the phase
Returns
current canvas.

◆ SetLineJoinStyle()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetLineJoinStyle ( int  lineJoinStyle )
inlinevirtual

Sets the line join style, the shape to be used at the corners of paths when they are stroked.

Parameters
lineJoinStyle a line join style to be set
Returns
current canvas.
See also
LineJoinStyle

for possible values.

◆ SetLineWidth()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetLineWidth ( float  lineWidth )
inlinevirtual

Sets line width.

Parameters
lineWidth line width.
Returns
current canvas.

◆ SetMiterLimit()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetMiterLimit ( float  miterLimit )
inlinevirtual

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.

Parameters
miterLimit a miter limit to be set
Returns
current canvas.

◆ SetRenderingIntent()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetRenderingIntent ( PdfName  renderingIntent )
inlinevirtual

Set the rendering intent.

Set the rendering intent. possible values are: PdfName.AbsoluteColorimetric, PdfName.RelativeColorimetric, PdfName.Saturation, PdfName.Perceptual.

Parameters
renderingIntent a PdfName containing a color metric
Returns
current canvas.

◆ SetStrokeColor()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetStrokeColor ( Color  color )
inlinevirtual

Changes the current color for stroking paths.

Parameters
color stroke color.
Returns
current canvas.

◆ SetStrokeColorCmyk()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetStrokeColorCmyk ( float  c,
float  m,
float  y,
float  k 
)
inlinevirtual

Changes the current color for stroking paths to a CMYK value.

Parameters
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]
Returns
current canvas.

◆ SetStrokeColorGray()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetStrokeColorGray ( float  g )
inlinevirtual

Changes the current color for stroking paths to a grayscale value.

Parameters
g a grayscale value in the range [0,1]
Returns
current canvas.

◆ SetStrokeColorRgb()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetStrokeColorRgb ( float  r,
float  g,
float  b 
)
inlinevirtual

Changes the current color for stroking paths to an RGB value.

Parameters
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]
Returns
current canvas.

◆ SetStrokeColorShading()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetStrokeColorShading ( PdfPattern.Shading  shading )
inlinevirtual

Adds or changes the shading of the current stroke color path.

Parameters
shading the shading
Returns
current canvas.

◆ SetTextMatrix() [1/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetTextMatrix ( AffineTransform  transform )
inlinevirtual

Replaces the text matrix.

Replaces the text matrix. Contrast with ConcatMatrix(iText.Kernel.Pdf.PdfArray)

Parameters
transform new textmatrix as transformation
Returns
current canvas

◆ SetTextMatrix() [2/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetTextMatrix ( float  a,
float  b,
float  c,
float  d,
float  x,
float  y 
)
inlinevirtual

Replaces the text matrix.

Replaces the text matrix. Contrast with ConcatMatrix(iText.Kernel.Pdf.PdfArray)

Parameters
a operand 1,1 in the matrix.
b operand 1,2 in the matrix.
c operand 2,1 in the matrix.
d operand 2,2 in the matrix.
x operand 3,1 in the matrix.
y operand 3,2 in the matrix.
Returns
current canvas.

◆ SetTextMatrix() [3/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetTextMatrix ( float  x,
float  y 
)
inlinevirtual

Changes the text matrix.

Parameters
x operand 3,1 in the matrix.
y operand 3,2 in the matrix.
Returns
current canvas.

◆ SetTextRenderingMode()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetTextRenderingMode ( int  textRenderingMode )
inlinevirtual

Sets text rendering mode.

Parameters
textRenderingMode text rendering mode

PdfCanvasConstants.

Returns
current canvas.

◆ SetTextRise()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetTextRise ( float  textRise )
inlinevirtual

Sets the text rise parameter.

Sets the text rise parameter.
This allows to write text in subscript or superscript mode.

Parameters
textRise a parameter
Returns
current canvas.

◆ SetWordSpacing()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.SetWordSpacing ( float  wordSpacing )
inlinevirtual

Sets the word spacing parameter.

Parameters
wordSpacing a parameter
Returns
current canvas.

◆ ShowText() [1/4]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ShowText ( GlyphLine  text )
inlinevirtual

Shows text (operator Tj).

Parameters
text text to show.
Returns
current canvas.

◆ ShowText() [2/4]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ShowText ( GlyphLine  text,
IEnumerator< GlyphLine.GlyphLinePart iterator 
)
inlinevirtual

Shows text (operator Tj).

Parameters
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
Returns
current canvas.

◆ ShowText() [3/4]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ShowText ( PdfArray  textArray )
inlinevirtual

Shows text (operator TJ)

Parameters
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.
Returns
current canvas.

◆ ShowText() [4/4]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.ShowText ( String  text )
inlinevirtual

Shows text (operator Tj).

Parameters
text text to show.
Returns
current canvas.

◆ Stroke()

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.Stroke ( )
inlinevirtual

Strokes the path.

Returns
current canvas.

◆ WriteLiteral() [1/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.WriteLiteral ( char  c )
inlinevirtual

Outputs a char directly to the content.

Parameters
c the char
Returns
current canvas.

◆ WriteLiteral() [2/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.WriteLiteral ( float  n )
inlinevirtual

Outputs a float directly to the content.

Parameters
n the float
Returns
current canvas.

◆ WriteLiteral() [3/3]

virtual iText.Kernel.Pdf.Canvas.PdfCanvas iText.Kernel.Pdf.Canvas.PdfCanvas.WriteLiteral ( String  s )
inlinevirtual

Outputs a String directly to the content.

Parameters
s the String
Returns
current canvas.

Member Data Documentation

◆ contentStream

PdfStream iText.Kernel.Pdf.Canvas.PdfCanvas.contentStream
package

the content stream for this canvas object.

◆ currentGs

CanvasGraphicsState iText.Kernel.Pdf.Canvas.PdfCanvas.currentGs = new CanvasGraphicsState()
package

the current graphics state.

◆ document

PdfDocument iText.Kernel.Pdf.Canvas.PdfCanvas.document
package

the document that the resulting content stream of this canvas will be written to.

◆ gsStack

Stack<CanvasGraphicsState> iText.Kernel.Pdf.Canvas.PdfCanvas.gsStack = new Stack<CanvasGraphicsState>()
package

a LIFO stack of graphics state saved states.

◆ layerDepth

IList iText.Kernel.Pdf.Canvas.PdfCanvas.layerDepth
package

The list where we save/restore the layer depth.

◆ mcDepth

int iText.Kernel.Pdf.Canvas.PdfCanvas.mcDepth
package

a counter variable for the marked content stack.

◆ resources

PdfResources iText.Kernel.Pdf.Canvas.PdfCanvas.resources
package

the resources for the page that this canvas belongs to.

See also
iText.Kernel.Pdf.PdfResources