#include <Element.h>
Public Types | |
| enum | Type { e_null , e_path , e_text_begin , e_text , e_text_new_line , e_text_end , e_image , e_inline_image , e_shading , e_form , e_group_begin , e_group_end , e_marked_content_begin , e_marked_content_end , e_marked_content_point } |
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).
| pdftron::PDF::Element::Element | ( | ) |
| pdftron::PDF::Element::Element | ( | const Element & | c | ) |
| Rect pdftron::PDF::Element::GetBBox | ( | ) |
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.
| out_bbox | (Filled by the method) A reference to a rectangle specifying the bounding box of Element (a rectangle that surrounds the entire element). The coordinates are represented in the default PDF page coordinate system and are using units called points ( 1 point = 1/72 inch = 2.54 /72 centimeter). The bounding box already accounts for the effects of current transformation matrix (CTM), text matrix, font size, and other properties in the graphics state. If this is a non-graphical element (i.e. the method returns false) the bounding box is undefined. |
| bool pdftron::PDF::Element::GetBBox | ( | Rect & | out_bbox | ) |
| int pdftron::PDF::Element::GetBitsPerComponent | ( | ) | const |
| CharIterator pdftron::PDF::Element::GetCharIterator | ( | ) |
CharIterator points to CharData. CharData is a data structure that contains the char_code number (used to retrieve glyph outlines, to map to Unicode, etc.), character positioning information (x, y), and the number of bytes taken by the character within the text buffer.
An example of how to use CharIterator.
| int pdftron::PDF::Element::GetComponentNum | ( | ) | const |
| Common::Matrix2D pdftron::PDF::Element::GetCTM | ( | ) |
| SDF::Obj pdftron::PDF::Element::GetDecodeArray | ( | ) | const |
| ColorSpace pdftron::PDF::Element::GetImageColorSpace | ( | ) | const |
Convert PDF image to GDI+ Bitmap.
The returned color space may be any type of color space except Pattern.
| Filters::Filter pdftron::PDF::Element::GetImageData | ( | ) | const |
| int pdftron::PDF::Element::GetImageDataSize | ( | ) | const |
| int pdftron::PDF::Element::GetImageHeight | ( | ) | const |
| GState::RenderingIntent pdftron::PDF::Element::GetImageRenderingIntent | ( | ) | const |
| int pdftron::PDF::Element::GetImageWidth | ( | ) | const |
| SDF::Obj pdftron::PDF::Element::GetMask | ( | ) | const |
If IsImageMask() return true, this method will return NULL.
| SDF::Obj pdftron::PDF::Element::GetMCPropertyDict | ( | ) |
| SDF::Obj pdftron::PDF::Element::GetMCTag | ( | ) |
| Point pdftron::PDF::Element::GetNewTextLineOffset | ( | ) |
Returns 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.
| void pdftron::PDF::Element::GetNewTextLineOffset | ( | double & | out_x, |
| double & | out_y ) |
| Struct::SElement pdftron::PDF::Element::GetParentStructElement | ( | ) |
| PathData pdftron::PDF::Element::GetPathData | ( | ) | const |
| double pdftron::PDF::Element::GetPosAdjustment | ( | ) |
| int pdftron::PDF::Element::GetStructMCID | ( | ) |
| const UChar * pdftron::PDF::Element::GetTextData | ( | ) |
| UInt32 pdftron::PDF::Element::GetTextDataSize | ( | ) |
| double pdftron::PDF::Element::GetTextLength | ( | ) |
The total sum of all of the advance values from rendering all of the characters within this element, including the advance value on the glyphs, the effect of properties such as 'char-spacing', 'word-spacing' and positioning adjustments on 'TJ' elements.
| Common::Matrix2D pdftron::PDF::Element::GetTextMatrix | ( | ) |
| UString pdftron::PDF::Element::GetTextString | ( | ) |
| Type pdftron::PDF::Element::GetType | ( | ) |
| bool pdftron::PDF::Element::HasTextMatrix | ( | ) |
| bool pdftron::PDF::Element::IsClippingPath | ( | ) |
| bool pdftron::PDF::Element::IsClipWindingFill | ( | ) |
| bool pdftron::PDF::Element::IsFilled | ( | ) |
| bool pdftron::PDF::Element::IsImageInterpolate | ( | ) | const |
| bool pdftron::PDF::Element::IsImageMask | ( | ) | const |
| bool pdftron::PDF::Element::IsOCVisible | ( | ) |
When enumerating page content, OCG::Context can be passed as a parameter in ElementReader.Begin() method. When using PDFDraw, PDFRasterizer, or PDFView class to render PDF pages use PDFDraw::SetOCGContext() method to select an OC context.
| bool pdftron::PDF::Element::IsStroked | ( | ) |
| bool pdftron::PDF::Element::IsWindingFill | ( | ) |
According non-zero winding rule, you can determine whether a test point is inside or outside a closed curve as follows: Draw a line from a test point to a point that is distant from the curve. Count the number of times the curve crosses the test line from left to right, and count the number of times the curve crosses the test line from right to left. If those two numbers are the same, the test point is outside the curve; otherwise, the test point is inside the curve.
According to even-odd rule, you can determine whether a test point is inside or outside a closed curve as follows: Draw a line from the test point to a point that is distant from the curve. If that line crosses the curve an odd number of times, the test point is inside the curve; otherwise, the test point is outside the curve.
| void pdftron::PDF::Element::SetClipWindingFill | ( | bool | winding_rule | ) |
Sets 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. |
| void pdftron::PDF::Element::SetNewTextLineOffset | ( | double | dx, |
| double | dy ) |
Sets the offset (dx, dy) to the start of the current line relative to the beginning of the previous line.
| dx | horizontal offset to the start of the curret line |
| dy | vertical offset to the start of the current line |
| void pdftron::PDF::Element::SetPathClip | ( | bool | clip | ) |
Indicate whether the path is a clipping path or non-clipping path
| clip | true to set path to clipping path. False for non-clipping path. |
| void pdftron::PDF::Element::SetPathData | ( | const PathData & | data | ) |
| void pdftron::PDF::Element::SetPathFill | ( | bool | fill | ) |
Indicate whether the path should be filled
| fill | true to set path to be filled. False for no fill path. |
| void pdftron::PDF::Element::SetPathStroke | ( | bool | stroke | ) |
Indicate whether the path should be stroked
| stroke | true to set path to be stroked. False for no stroke path. |
| void pdftron::PDF::Element::SetPosAdjustment | ( | double | adjust | ) |
| adjust | number to set the horizontal adjustment to |
| void pdftron::PDF::Element::SetTextData | ( | const UChar * | buf_text_data, |
| int | text_data_size ) |
Set the text data for the current e_text Element.
| buf_text_data | a pointer to a buffer containing text. |
| text_data_size | the size of the internal text buffer |
| void pdftron::PDF::Element::SetTextMatrix | ( | Common::Matrix2D & | mtx | ) |
Sets the text matrix for a text element.
| mtx | The new text matrix for this text element |
| void pdftron::PDF::Element::SetTextMatrix | ( | double | a, |
| double | b, | ||
| double | c, | ||
| double | d, | ||
| double | h, | ||
| double | v ) |
Sets 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. |
| void pdftron::PDF::Element::SetWindingFill | ( | bool | winding_rule | ) |
Sets 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. |
| void pdftron::PDF::Element::UpdateTextMetrics | ( | ) |
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.