public class ElementBuilder
extends java.lang.Object
Note: Analogous to ElementReader, every call to ElementBuilder.Create? method destroys the Element currently associated with the builder and all previous Element pointers are invalidated.
Constructor and Description |
---|
ElementBuilder()
Instantiates a new element builder.
|
Modifier and Type | Method and Description |
---|---|
void |
arcTo(double xr,
double yr,
double rx,
boolean isLargeArc,
boolean sweep,
double endX,
double endY)
Draw an arc from the current point to the end point.
|
void |
arcTo(double x,
double y,
double width,
double height,
double start,
double extent)
Draw an arc with the specified parameters (upper left corner, width, height and angles).
|
void |
closePath()
Closes the current subpath.
|
Element |
createEllipse(double cx,
double cy,
double rx,
double ry)
Create an ellipse (or circle, if rx == ry) path Element.
|
Element |
createForm(Obj form)
Create a Form XObject Element.
|
Element |
createForm(Page page)
Create a Form XObject Element using the content of the existing page.
|
Element |
createForm(Page page,
PDFDoc doc)
Create a Form XObject Element using the content of the existing page.
|
Element |
createGroupBegin()
Create e_group_begin Element (i.e.
|
Element |
createGroupEnd()
Create e_group_end Element (i.e.
|
Element |
createImage(Image img)
Create a content image Element out of a given document Image.
|
Element |
createImage(Image img,
double x,
double y,
double hscale,
double vscale)
Create a content image Element out of a given document Image with
the lower left corner at (x, y), and scale factors (hscale, vscale).
|
Element |
createImage(Image img,
Matrix2D mtx)
Create a content image Element out of a given document Image.
|
Element |
createPath(double[] points,
byte[] seg_types)
Create a path Element using given path segment data.
|
Element |
createRect(double x,
double y,
double width,
double height)
Create a rectangle path Element.
|
Element |
createShading(Shading sh)
Create a shading Element.
|
Element |
createTextBegin()
Start a text block ('BT' operator in PDF content stream).
|
Element |
createTextBegin(Font font,
double font_sz)
Start a text block ('BT' operator in PDF content stream).
|
Element |
createTextEnd()
Ends a text block.
|
Element |
createTextNewLine()
Create e_text_new_line Element (i.e.
|
Element |
createTextNewLine(double dx,
double dy)
Create e_text_new_line Element (i.e.
|
Element |
createTextRun(java.lang.String text_data)
Create a new text run.
|
Element |
createTextRun(java.lang.String text_data,
Font font,
double font_sz)
Create a text run using the given font.
|
Element |
createUnicodeTextRun(java.lang.String text_data)
Create a new Unicode text run.
|
void |
curveTo(double cx1,
double cy1,
double cx2,
double cy2,
double x2,
double y2)
Draw a Bezier curve from the current point to the given point (x2, y2) using
(cx1, cy1) and (cx2, cy2) as control points.
|
void |
destroy()
Frees the native memory of the object.
|
void |
ellipse(double cx,
double cy,
double rx,
double ry)
Add an ellipse (or circle, if rx == ry) to the current path as a complete subpath.
|
void |
lineTo(double x,
double y)
Draw a line from the current point to the given point.
|
void |
moveTo(double x,
double y)
Set the current point.
|
void |
pathBegin()
Starts building a new path Element that can contain an arbitrary sequence
of lines, curves, and rectangles.
|
Element |
pathEnd()
Finishes building of the path Element.
|
void |
rect(double x,
double y,
double width,
double height)
Add a rectangle to the current path as a complete subpath.
|
void |
reset()
Resets the graphics state of this Element to the default graphics state (i.e.
|
void |
reset(GState gs)
The function sets the graphics state of this Element to the given value.
|
public ElementBuilder() throws PDFNetException
PDFNetException
public void destroy() throws PDFNetException
PDFNetException
public void reset() throws PDFNetException
PDFNetException
public void reset(GState gs) throws PDFNetException
gs
- the given graphics statePDFNetException
public Element createImage(Image img) throws PDFNetException
img
- the given documen imagePDFNetException
public Element createImage(Image img, Matrix2D mtx) throws PDFNetException
img
- the given document imagemtx
- the image transformation matrix.PDFNetException
public Element createImage(Image img, double x, double y, double hscale, double vscale) throws PDFNetException
img
- the give document imagex
- the x coordinate of the lower left corner of the imagey
- the y coordinate of the lower left corner of the imagehscale
- the horizontal scale factorvscale
- the vertical scale factorPDFNetException
public Element createGroupBegin() throws PDFNetException
PDFNetException
public Element createGroupEnd() throws PDFNetException
PDFNetException
public Element createShading(Shading sh) throws PDFNetException
sh
- the shPDFNetException
public Element createForm(Obj form) throws PDFNetException
form
- a Form XObject content streamPDFNetException
public Element createForm(Page page) throws PDFNetException
page
- A page used to create the Form XObject.PDFNetException
public Element createForm(Page page, PDFDoc doc) throws PDFNetException
page
- A page used to create the Form XObject.doc
- Destination document for the Form XObject.PDFNetException
public Element createTextBegin(Font font, double font_sz) throws PDFNetException
font
- the font to usefont_sz
- the font sizePDFNetException
public Element createTextBegin() throws PDFNetException
PDFNetException
public Element createTextEnd() throws PDFNetException
PDFNetException
public Element createTextRun(java.lang.String text_data, Font font, double font_sz) throws PDFNetException
Note: a text run can be created only within a text block
text_data
- the text contentfont
- the given fontfont_sz
- the font sizePDFNetException
public Element createTextRun(java.lang.String text_data) throws PDFNetException
Note: a text run can be created only within a text block
Note: you must set the current Font and font size before calling this function.
text_data
- the text contentPDFNetException
public Element createUnicodeTextRun(java.lang.String text_data) throws PDFNetException
Note: you must set the current Font and font size before calling this function and the font must be created using Font::CreateCIDTrueTypeFont() method.
Note: a text run can be created only within a text block
text_data
- the text contentPDFNetException
public Element createTextNewLine(double dx, double dy) throws PDFNetException
dx
- the x coordinate of the new linedy
- the y coordinate of the new linePDFNetException
public Element createTextNewLine() throws PDFNetException
PDFNetException
public Element createPath(double[] points, byte[] seg_types) throws PDFNetException
points
- the points consists of the pathseg_types
- the segment typePDFNetException
public Element createRect(double x, double y, double width, double height) throws PDFNetException
x
- the x coordinate of the lower left cornery
- the y coordinate of the lower left cornerwidth
- the width of the rectangleheight
- the height of the rectanglePDFNetException
public Element createEllipse(double cx, double cy, double rx, double ry) throws PDFNetException
cx
- the x coordinate of the ellipse centercy
- the y coordinate of the ellipse centerrx
- the width of rectangle containing the ellipsery
- the height of rectangle containing the ellipsePDFNetException
public void pathBegin() throws PDFNetException
PDFNetException
public Element pathEnd() throws PDFNetException
PDFNetException
public void rect(double x, double y, double width, double height) throws PDFNetException
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglewidth
- the width of the rectangleheight
- the height of the rectanglePDFNetException
public void moveTo(double x, double y) throws PDFNetException
x
- the x coordinate of the current pointy
- the y coordinate of the current pointPDFNetException
public void lineTo(double x, double y) throws PDFNetException
x
- the x coordinate of the given pointy
- the y coordinate of the given pointPDFNetException
public void curveTo(double cx1, double cy1, double cx2, double cy2, double x2, double y2) throws PDFNetException
cx1
- the x coordinate of the control point 1cy1
- the y coordinate of the control point 1cx2
- the x coordinate of the control point 2cy2
- the y coordinate of the control point 2x2
- the x coordinate of the end pointy2
- the y coordinate of the end pointPDFNetException
public void arcTo(double x, double y, double width, double height, double start, double extent) throws PDFNetException
x
- the x coordinates of the lower left corner of the ellipse encompassing rectangley
- the y coordinates of the lower left corner of the ellipse encompassing rectanglewidth
- the width of the full ellipse (not considering the angular extents).height
- the height of the full ellipse (not considering the angular extents).start
- starting angle of the arc in degreesextent
- angular extent of the arc in degreesPDFNetException
public void arcTo(double xr, double yr, double rx, boolean isLargeArc, boolean sweep, double endX, double endY) throws PDFNetException
Note: The Arc is defined the same way as it is specified by SVG or XPS standards. For further questions please refer to the XPS or SVG standards.
xr
- the x radius for the arcyr
- the y radius for the arcrx
- x-axis rotation in degreesisLargeArc
- indicates if smaller or larger arc is chosen
1 - one of the two larger arc sweeps is chosen
0 - one of the two smaller arc sweeps is chosensweep
- direction in which arc is drawn (1 - clockwise, 0 - counterclockwise)endX
- the x coordinate of the end pointendY
- the y coordinate of the end pointPDFNetException
public void ellipse(double cx, double cy, double rx, double ry) throws PDFNetException
cx
- the x coordinate of the center of the ellipsecy
- the y coordinate of the center of the ellipserx
- the x radii of the ellipsery
- the y radii of the ellipsePDFNetException
public void closePath() throws PDFNetException
PDFNetException