public class Element
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
e_form
The Constant e_form.
|
static int |
e_group_begin
The Constant e_group_begin.
|
static int |
e_group_end
The Constant e_group_end.
|
static int |
e_image
The Constant e_image.
|
static int |
e_inline_image
The Constant e_inline_image.
|
static int |
e_marked_content_begin
The Constant e_marked_content_begin.
|
static int |
e_marked_content_end
The Constant e_marked_content_end.
|
static int |
e_marked_content_point
The Constant e_marked_content_point.
|
static int |
e_null
The Constant e_null.
|
static int |
e_path
The Constant e_path.
|
static int |
e_shading
The Constant e_shading.
|
static int |
e_text
The Constant e_text.
|
static int |
e_text_begin
The Constant e_text_begin.
|
static int |
e_text_end
The Constant e_text_end.
|
static int |
e_text_new_line
The Constant e_text_new_line.
|
Modifier and Type | Method and Description |
---|---|
Rect |
getBBox()
Obtains the bounding box for a graphical element.
|
int |
getBitsPerComponent()
Get the bits per component.
|
CharIterator |
getCharIterator()
Get the char iterator.
|
int |
getComponentNum()
Get the number of color components per sample.
|
Matrix2D |
getCTM()
Get the current transformation matrix.
|
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 |
getMask()
Get the image mask.
|
Obj |
getMCPropertyDict()
Get the dictionary contains property list.
|
Obj |
getMCTag()
Get the marked content tag.
|
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.
|
java.lang.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 |
isClippingPath()
Checks if current element is a clipping path.
|
boolean |
isClipWindingFill()
Checks if current element is clip winding fill.
|
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.
|
public static final int e_null
public static final int e_path
public static final int e_text_begin
public static final int e_text
public static final int e_text_new_line
public static final int e_text_end
public static final int e_image
public static final int e_inline_image
public static final int e_shading
public static final int e_form
public static final int e_group_begin
public static final int e_group_end
public static final int e_marked_content_begin
public static final int e_marked_content_end
public static final int e_marked_content_point
public int getType() throws PDFNetException
PDFNetException
public GState getGState() throws PDFNetException
PDFNetException
public Matrix2D getCTM() throws PDFNetException
PDFNetException
public Rect getBBox() throws PDFNetException
PDFNetException
public SElement getParentStructElement() throws PDFNetException
PDFNetException
public int getStructMCID() throws PDFNetException
PDFNetException
public boolean isOCVisible() throws PDFNetException
PDFNetException
public boolean isClippingPath() throws PDFNetException
PDFNetException
public PathData getPathData() throws PDFNetException
PDFNetException
public boolean isStroked() throws PDFNetException
PDFNetException
public boolean isFilled() throws PDFNetException
PDFNetException
public boolean isWindingFill() throws PDFNetException
PDFNetException
public boolean isClipWindingFill() throws PDFNetException
PDFNetException
public void setPathClip(boolean clip) throws PDFNetException
clip
- the new path clipPDFNetException
public void setPathData(PathData data) throws PDFNetException
PDFNetException
public void setPathStroke(boolean stroke) throws PDFNetException
stroke
- the new path strokePDFNetException
public void setPathFill(boolean fill) throws PDFNetException
fill
- the new path fillPDFNetException
public void setWindingFill(boolean winding_rule) throws PDFNetException
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
public void setClipWindingFill(boolean winding_rule) throws PDFNetException
winding_rule
- if winding_rule is true clipping should use non-zero
winding rule, or false for even-odd rule.PDFNetException
public Obj getXObject() throws PDFNetException
PDFNetException
public Filter getImageData() throws PDFNetException
PDFNetException
public int getImageDataSize() throws PDFNetException
PDFNetException
public ColorSpace getImageColorSpace() throws PDFNetException
PDFNetException
public int getImageWidth() throws PDFNetException
PDFNetException
public int getImageHeight() throws PDFNetException
PDFNetException
public Obj getDecodeArray() throws PDFNetException
PDFNetException
public int getBitsPerComponent() throws PDFNetException
PDFNetException
public int getComponentNum() throws PDFNetException
PDFNetException
public boolean isImageMask() throws PDFNetException
PDFNetException
public boolean isImageInterpolate() throws PDFNetException
PDFNetException
public Obj getMask() throws PDFNetException
PDFNetException
public int getImageRenderingIntent() throws PDFNetException
PDFNetException
public java.lang.String getTextString() throws PDFNetException
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
public byte[] getTextData() throws PDFNetException
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
public Matrix2D getTextMatrix() throws PDFNetException
PDFNetException
public CharIterator getCharIterator() throws PDFNetException
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
public double getTextLength() throws PDFNetException
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
public double getPosAdjustment() throws PDFNetException
Note: because CharIterator positioning information already accounts for TJ adjustments this method is rarely used.
PDFNetException
public double[] getNewTextLineOffset() throws PDFNetException
PDFNetException
public boolean hasTextMatrix() throws PDFNetException
PDFNetException
public void setTextData(byte[] text_data) throws PDFNetException
text_data
- a pointer to a buffer containing text.PDFNetException
public void setTextMatrix(Matrix2D mtx) throws PDFNetException
mtx
- The new text matrix for this text elementPDFNetException
public void setTextMatrix(double a, double b, double c, double d, double h, double v) throws PDFNetException
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
public void setPosAdjustment(double adjust) throws PDFNetException
adjust
- the new position adjustmentPDFNetException
public void updateTextMetrics() throws PDFNetException
PDFNetException
public void setNewTextLineOffset(double dx, double dy) throws PDFNetException
dx
- the x coordinatedy
- the y coordinatePDFNetException
public Shading getShading() throws PDFNetException
PDFNetException
public Obj getMCPropertyDict() throws PDFNetException
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
public Obj getMCTag() throws PDFNetException
PDFNetException