java.lang.Object | |
↳ | com.pdftron.pdf.Element |
Element is the abstract interface used to access graphical elements used to build the display list. Just like many other classes in PDFNet (e.g. ColorSpace, Font, Annot, etc), Element class follows the composite design pattern. This means that all Elements are accessed through the same interface, but depending on the Element type (that can be obtained using GetType()), only methods related to that type can be called. For example, if GetType() returns e_image, it is illegal to call a method specific to another Element type (i.e. a call to a text specific GetTextData() will throw an Exception).
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | e_form | The Constant e_form. | |||||||||
int | e_group_begin | The Constant e_group_begin. | |||||||||
int | e_group_end | The Constant e_group_end. | |||||||||
int | e_image | The Constant e_image. | |||||||||
int | e_inline_image | The Constant e_inline_image. | |||||||||
int | e_marked_content_begin | The Constant e_marked_content_begin. | |||||||||
int | e_marked_content_end | The Constant e_marked_content_end. | |||||||||
int | e_marked_content_point | The Constant e_marked_content_point. | |||||||||
int | e_null | The Constant e_null. | |||||||||
int | e_path | The Constant e_path. | |||||||||
int | e_shading | The Constant e_shading. | |||||||||
int | e_text | The Constant e_text. | |||||||||
int | e_text_begin | The Constant e_text_begin. | |||||||||
int | e_text_end | The Constant e_text_end. | |||||||||
int | e_text_new_line | The Constant e_text_new_line. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Rect |
getBBox()
Obtains the bounding box for a graphical element.
| ||||||||||
int |
getBitsPerComponent()
Get the bits per component.
| ||||||||||
Matrix2D |
getCTM()
Get the current transformation matrix.
| ||||||||||
CharIterator |
getCharIterator()
Get the char iterator.
| ||||||||||
int |
getComponentNum()
Get the number of color components per sample.
| ||||||||||
Obj |
getDecodeArray()
Get the decode array.
| ||||||||||
GState |
getGState()
Get the GState.
| ||||||||||
ColorSpace |
getImageColorSpace()
Get the image color space.
| ||||||||||
Filter |
getImageData()
Get the image data.
| ||||||||||
int |
getImageDataSize()
Get the image data size.
| ||||||||||
int |
getImageHeight()
Get the image height.
| ||||||||||
int |
getImageRenderingIntent()
Get the image rendering intent.
| ||||||||||
int |
getImageWidth()
Get the image width.
| ||||||||||
Obj |
getMCPropertyDict()
Get the dictionary contains property list.
| ||||||||||
Obj |
getMCTag()
Get the marked content tag.
| ||||||||||
Obj |
getMask()
Get the image mask.
| ||||||||||
double[] |
getNewTextLineOffset()
Get the offset (out_x, out_y) to the start of the current line relative to
the beginning of the previous line.
| ||||||||||
SElement |
getParentStructElement()
Get the parent struct element.
| ||||||||||
PathData |
getPathData()
Returns the PathData stored by the path element.
| ||||||||||
double |
getPosAdjustment()
Get the pos adjustment.
| ||||||||||
Shading |
getShading()
Get the shading.
| ||||||||||
int |
getStructMCID()
Get the Marked Content Identifier.
| ||||||||||
byte[] |
getTextData()
Get the text data.
| ||||||||||
double |
getTextLength()
Get the text length.
| ||||||||||
Matrix2D |
getTextMatrix()
Get the text matrix.
| ||||||||||
String |
getTextString()
Get the text string.
| ||||||||||
int |
getType()
Get the element type.
| ||||||||||
Obj |
getXObject()
Get the SDF object of the Image/Form object.
| ||||||||||
boolean |
hasTextMatrix()
Checks for text matrix.
| ||||||||||
boolean |
isClipWindingFill()
Checks if current element is clip winding fill.
| ||||||||||
boolean |
isClippingPath()
Checks if current element is a clipping path.
| ||||||||||
boolean |
isFilled()
Checks if current path element is filled.
| ||||||||||
boolean |
isImageInterpolate()
Checks if current element is image interpolate.
| ||||||||||
boolean |
isImageMask()
Checks if current element is image mask.
| ||||||||||
boolean |
isOCVisible()
Checks if current element is visible in optional-content context.
| ||||||||||
boolean |
isStroked()
Checks if path current element is stroked.
| ||||||||||
boolean |
isWindingFill()
Checks if current element is winding fill.
| ||||||||||
void |
setClipWindingFill(boolean winding_rule)
Set clipping path's fill rule.
| ||||||||||
void |
setNewTextLineOffset(double dx, double dy)
Set the offset (dx, dy) to the start of the current line relative to the beginning
of the previous line.
| ||||||||||
void |
setPathClip(boolean clip)
Indicate whether the path is a clipping path or non-clipping path.
| ||||||||||
void |
setPathData(PathData data)
Set the PathData of this element.
| ||||||||||
void |
setPathFill(boolean fill)
Indicate whether the path should be filled.
| ||||||||||
void |
setPathStroke(boolean stroke)
Indicate whether the path should be stroked.
| ||||||||||
void |
setPosAdjustment(double adjust)
Set the position adjustment.
| ||||||||||
void |
setTextData(byte[] text_data)
Set the text data for the current e_text Element.
| ||||||||||
void |
setTextMatrix(double a, double b, double c, double d, double h, double v)
Set the text matrix for a text element.
| ||||||||||
void |
setTextMatrix(Matrix2D mtx)
Set the text matrix for a text element.
| ||||||||||
void |
setWindingFill(boolean winding_rule)
Set path's fill rule.
| ||||||||||
void |
updateTextMetrics()
Recompute the character positioning information (i.e.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The Constant e_form.
The Constant e_group_begin.
The Constant e_group_end.
The Constant e_image.
The Constant e_inline_image.
The Constant e_marked_content_begin.
The Constant e_marked_content_end.
The Constant e_marked_content_point.
The Constant e_null.
The Constant e_path.
The Constant e_shading.
The Constant e_text.
The Constant e_text_begin.
The Constant e_text_end.
The Constant e_text_new_line.
Obtains the bounding box for a graphical element. Calculates the bounding box for a graphical element (i.e. an Element that belongs to one of following types: e_path, e_text, e_image, e_inline_image, e_shading e_form). The returned bounding box is guaranteed to encompass the Element, but is not guaranteed to be the smallest box that could contain the element. For example, for Bezier curves the bounding box will enclose all control points, not just the curve itself.
PDFNetException |
---|
Get the bits per component.
PDFNetException |
---|
Get the current transformation matrix.
PDFNetException |
---|
Get the char iterator.
Note: CharIterator follows the standard STL forward-iterator interface. An example of how to use CharIterator.
for (CharIterator itr = element.GetCharIterator(); itr.HasNext(); itr.Next()) {
unsigned int char_code = itr.Current().char_code;
double char_pos_x = itr.Current().x;
double char_pos_y = itr.Current().y;
}
* Note: Character positioning information (x, y) is represented in text space. In order to get the positioning in the user space, the returned value should be scaled using the text matrix (GetTextMatrix()) and the current transformation matrix (GetCTM()). See section 4.2 'Other Coordinate Spaces' in PDF Reference Manual for details and PDFNet FAQ - "How do I get absolute/relative text and character positioning".
* Note: whithin a text run a character may occupy more than a single byte (e.g. in case of composite/Type0 fonts). The role of CharIterator/CharData is to provide a uniform and easy to use inteface to access character information.
PDFNetException |
---|
Get the number of color components per sample.
PDFNetException |
---|
Get the decode array.
PDFNetException |
---|
Get the image color space.
PDFNetException |
---|
Get the image rendering intent.
PDFNetException |
---|
Get the dictionary contains property list.
Note: the function automatically looks under Properties sub-dictionary of the current resource dictionary if the dictionary is not in-line. Therefore you can assume that returned Obj is dictionary if it is not NULL.
PDFNetException |
---|
Get the marked content tag.
PDFNetException |
---|
Get the image mask.
PDFNetException |
---|
Get the offset (out_x, out_y) to the start of the current line relative to the beginning of the previous line. out_x and out_y are numbers expressed in unscaled text space units. The returned numbers correspond to the arguments of 'Td' operator.
PDFNetException |
---|
Get the parent struct element.
PDFNetException |
---|
Returns the PathData stored by the path element.
PDFNetException |
---|
Get the pos adjustment.
Note: because CharIterator positioning information already accounts for TJ adjustments this method is rarely used.
PDFNetException |
---|
Get the Marked Content Identifier.
PDFNetException |
---|
Get the text data.
Note: GetTextData() returns the raw text data and not a Unicode string. In PDF text can be encoded using various encoding schemes so it is necessary to consider Font encoding while processing the content of this buffer.
Note: Most of the time GetTextString() is what you are looking for instead. GetTextString() maps the raw text directly into Unicode (as specified by Adobe Glyph List (AGL) ). Even if you would prefer to decode text yourself it is more convenient to use CharIterators returned by CharBegin()/CharEnd() and PDF::Font code mapping methods.
Note: the buffer owner is the current element (i.e. ElementReader or ElementBuilder).
PDFNetException |
---|
Get the text length.
Note: Computed text length is represented in text space. In order to get the length of the text run in the user space, the returned value should be scaled using the text matrix (GetTextMatrix()) and the current transformation matrix (GetCTM()). See section 4.2 'Other Coordinate Spaces' in PDF Reference Manual for details.
PDFNetException |
---|
Get the text string.
Note: In PDF text can be encoded using various encoding schemes and in some cases it is not possible to extract Unicode encoding. If it is not possible to map charcode to Unicode the function will map a character to undefined code, 0xFFFD. This code is defined in private Unicode range.
Note: If you would like to map raw text to Unicode (or some other encoding) yourself use CharIterators returned by CharBegin()/CharEnd() and PDF::Font code mapping methods.
Note: The string owner is the current element (i.e. ElementReader or ElementBuilder).
PDFNetException |
---|
Get the SDF object of the Image/Form object.
PDFNetException |
---|
Checks for text matrix.
PDFNetException |
---|
Checks if current element is clip winding fill.
PDFNetException |
---|
Checks if current element is a clipping path.
PDFNetException |
---|
Checks if current path element is filled.
PDFNetException |
---|
Checks if current element is image interpolate.
PDFNetException |
---|
Checks if current element is image mask.
PDFNetException |
---|
Checks if current element is visible in optional-content context.
PDFNetException |
---|
Checks if path current element is stroked.
PDFNetException |
---|
Checks if current element is winding fill.
PDFNetException |
---|
Set clipping path's fill rule.
winding_rule | if winding_rule is true clipping should use non-zero winding rule, or false for even-odd rule. |
---|
PDFNetException |
---|
Set the offset (dx, dy) to the start of the current line relative to the beginning of the previous line.
dx | the x coordinate |
---|---|
dy | the y coordinate |
PDFNetException |
---|
Indicate whether the path is a clipping path or non-clipping path.
clip | the new path clip |
---|
PDFNetException |
---|
Set the PathData of this element. The PathData contains the array of points stored by the element and the array of path segment types.
PDFNetException |
---|
Indicate whether the path should be filled.
fill | the new path fill |
---|
PDFNetException |
---|
Indicate whether the path should be stroked.
stroke | the new path stroke |
---|
PDFNetException |
---|
Set the text data for the current e_text Element.
text_data | a pointer to a buffer containing text. |
---|
PDFNetException |
---|
Set the text matrix for a text element. This method accepts text transformation matrix components directly. A transformation matrix in PDF is specified by six numbers, usually in the form of an array containing six elements. In its most general form, this array is denoted [a b c d h v]; it can represent any linear transformation from one coordinate system to another. For more information about PDF matrices please refer to section 4.2.2 'Common Transformations' in PDF Reference Manual, and to documentation for Matrix2D class.
a | - horizontal 'scaling' component of the new text matrix. |
---|---|
b | - 'rotation' component of the new text matrix. |
c | - 'rotation' component of the new text matrix. |
d | - vertical 'scaling' component of the new text matrix. |
h | - horizontal translation component of the new text matrix. |
v | - vertical translation component of the new text matrix. |
PDFNetException |
---|
Set the text matrix for a text element.
mtx | The new text matrix for this text element |
---|
PDFNetException |
---|
Set path's fill rule.
winding_rule | if winding_rule is true path will be filled using non-zero winding fill rule, otherwise even-odd fill will be used. |
---|
PDFNetException |
---|
Recompute the character positioning information (i.e. CharIterator-s) and text length. Element objects caches text length and character positioning information. If the user modifies the text data or graphics state the cached information is not correct. UpdateTextMetrics() can be used to recalculate the correct positioning and length information.
PDFNetException |
---|