Comprehensive Guide for Developers: Features, Integration, and API Reference
The TextCommand class represents a command that can be performed on text in a Layout. Any of the text commands can be redone and undone using the Redo() and Undo() functions. For any of these functions to take effect, the SetModified() function should be called. More...
#include <pdfsdk/cxx/text_edit.h>
Public Member Functions | |
void | Redo () |
Redoes the applied text command. | |
void | Undo () |
Undoes the applied text command. | |
bool | IsFontSubstituted () const |
Checks if the font was substituted during the text command. | |
TextCommand (PDTTextCommand handle, bool adopt=false) noexcept | |
TextCommand (const TextCommand &rhs) noexcept | |
TextCommand & | operator= (const TextCommand &rhs) noexcept |
TextCommand (TextCommand &&rhs) noexcept | |
TextCommand & | operator= (TextCommand &&rhs) noexcept |
Static Public Member Functions | |
static TextCommand | DeleteText (Document doc, CharIterator beg, CharIterator end) |
Deletes the text within a specified range and returns the command. | |
static TextCommand | InsertText (Document doc, CharIterator pos, const PDTFontAttrs &font_attrs, const std::wstring &chars) |
Inserts the specified text at the position and returns the command. | |
static TextCommand | ReplaceText (Document doc, CharIterator beg, CharIterator end, const PDTFontAttrs &font_attrs, const std::wstring &chars) |
Replaces text within a specified range and returns the command. | |
static TextCommand | ChangeFont (Document doc, CharIterator beg, CharIterator end, PDAtom font_family, PDAtom font_format) |
Changes the font of text within a specified range and returns the command. | |
static TextCommand | ChangeFontStyle (Document doc, CharIterator beg, CharIterator end, PDFontStyle font_style) |
Changes the font style of text within a specified range and returns the command. | |
static TextCommand | ChangeFontSize (Document doc, CharIterator beg, CharIterator end, float font_size) |
Changes the font size of text within a specified range and returns the command. | |
static TextCommand | ChangeFontColor (Document doc, CharIterator beg, CharIterator end, PDColorValue font_color) |
Changes the font color of text within a specified range and returns the command. | |
static TextCommand | ChangeEscapement (Document doc, CharIterator begin, CharIterator end, PDTEscapement escapment) |
Changes the escapement (vertical location relative to the baseline, also known as superscript or subscript) of text within a specified range and returns the command. | |
static TextCommand | ChangeHorzScaling (Document doc, CharIterator begin, CharIterator end, float horz_scaling) |
Changes the horizontal scaling (horizontal stretch) of text within a specified range and returns the command. | |
static TextCommand | ChangeCharSpacing (Document doc, CharIterator begin, CharIterator end, float char_spacing) |
Changes the character spacing of text within a specified range and returns the command. | |
static TextCommand | ChangeParaAttrs (Document doc, CharIterator iter, const PDTParaAttrs ¶_attrs) |
Changes the paragraph attributes of text for a specific paragraph and returns the command. | |
static TextCommand | NewTextBlock (Document doc, Layout layout, const PointF &page_point, const PDTFontAttrs &font_attrs, const PDTParaAttrs ¶_attrs) |
Creates a new text block at a specified position and returns the command. | |
static TextCommand | DeleteTextBlock (Document doc, Layout layout, const TextBlock &block) |
Deletes a text block from a Layout and returns the command. | |
static TextCommand | MergeTextBlocks (Document doc, CharIterator begin, CharIterator end) |
Merges multiple text blocks into a single text block and returns the command. | |
static TextCommand | UpdateTextBlocks (Document doc, Layout layout) |
Updates all text blocks in a Layout and returns the command. | |
static TextCommand | MoveTextBlock (Document doc, Layout layout, size_t block_index, const PointF &pos) |
Moves a text block to a new position and returns the command. | |
static TextCommand | RotateTextBlock (Document doc, Layout layout, size_t block_index, float radians) |
Rotates a text block by a specified angle and returns the command. | |
static TextCommand | ScaleTextBlock (Document doc, Layout layout, size_t block_index, const SizeF &size) |
Scales a text block to a new size and returns the command. | |
static TextCommand | ResizeTextBlock (Document doc, Layout layout, size_t block_index, const SizeF &size) |
Resizes a text block to a new size and returns the command. | |
static TextCommand | SyncWithContent (Document doc, Layout layout, size_t block_index, bool on_top) |
Synchronizes a text block with its content and returns the command. | |
static TextCommand | ChangeListStyle (Document doc, CharIterator begin, CharIterator end, const PDTListLevelStyle &style) |
Changes the list style of text within a specified range and returns the command. | |
static TextCommand | ChangeListLevel (Document doc, CharIterator begin, CharIterator end, int change) |
Changes the list level of text within a specified range and returns the command. This refers to adjusting the indentation or hierarchy level of items within a list. | |
The TextCommand class represents a command that can be performed on text in a Layout. Any of the text commands can be redone and undone using the Redo() and Undo() functions. For any of these functions to take effect, the SetModified() function should be called.
|
inlinestatic |
Changes the character spacing of text within a specified range and returns the command.
[in] | doc | The opened document object. |
[in] | begin | The starting location (character iterator) of the text range to change the character spacing of. |
[in] | end | The ending location (character iterator) of the text range to change the character spacing of. |
[in] | char_spacing | The character spacing to change to. For more information refer to section 9.3.2 Character spacing of the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
|
inlinestatic |
Changes the escapement (vertical location relative to the baseline, also known as superscript or subscript) of text within a specified range and returns the command.
[in] | doc | The opened document object. |
[in] | begin | The starting location (character iterator) of the text range to change the escapement of. |
[in] | end | The ending location (character iterator) of the text range to change the escapement of. |
[in] | escapment | The escapement to change to. One of - none, subscript, superscript. |
|
inlinestatic |
Changes the font of text within a specified range and returns the command.
[in] | doc | The opened document object. |
[in] | beg | The starting location (character iterator) of the text range to change the font. |
[in] | end | The ending location (character iterator) of the text range to change the font. |
[in] | font_family | The font family to change to. |
[in] | font_format | The font format to change to. |
|
inlinestatic |
Changes the font color of text within a specified range and returns the command.
doc | The opened document object. |
beg | The starting location (character iterator) of the text range to change the font color of. |
end | The ending location (character iterator) of the text range to change the font color of. |
font_color | The font color to change to. A 32-bit ARGB value each field using 8-bits. |
|
inlinestatic |
Changes the font size of text within a specified range and returns the command.
[in] | doc | The opened document object. |
[in] | beg | The starting location (character iterator) of the text range to change the font size of. |
[in] | end | The ending location (character iterator) of the text range to change the font size of. |
[in] | font_size | The font size to change to. |
|
inlinestatic |
Changes the font style of text within a specified range and returns the command.
[in] | doc | The opened document object. |
[in] | beg | The starting location (character iterator) of the text range to change the font style of. |
[in] | end | The ending location (character iterator) of the text range to change the font style of. |
[in] | font_style | The font style to change to. |
|
inlinestatic |
Changes the horizontal scaling (horizontal stretch) of text within a specified range and returns the command.
[in] | doc | The opened document object. |
[in] | begin | The beginning location (character iterator) of the text range to change the horizontal scaling of. |
[in] | end | The ending location (character iterator) of the text range to change the horizontal scaling of. |
[in] | horz_scaling | The horizontal scaling to change to. For more information refer to section 9.3 Text state parameters and operators and section 9.3.4 Horizontal scaling of the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
|
inlinestatic |
Changes the list level of text within a specified range and returns the command. This refers to adjusting the indentation or hierarchy level of items within a list.
[in] | doc | The opened document object. |
[in] | begin | The starting location (character iterator) of the text range whose list level is to be altered. |
[in] | end | The ending location (character iterator) of the text range whose list level is to be altered. |
[in] | change | The desired list level to change to. |
|
inlinestatic |
Changes the list style of text within a specified range and returns the command.
[in] | doc | The opened document object. |
[in] | begin | The starting location (character iterator) of the text range to change the list style. |
[in] | end | The ending location (character iterator) of the text range to change the list style. |
[in] | style | A reference to the list level style to change to. This includes the labeling convention for list items, the font family, style, format etc. |
|
inlinestatic |
Changes the paragraph attributes of text for a specific paragraph and returns the command.
[in] | doc | The opened document object. |
[in] | iter | The location (character iterator) representing the paragraph of interest. |
[in] | para_attrs | A reference to the paragraph attributes to change to. These include the alignment of text, line and paragraph spacing, the first line and paragraph indentation. |
|
inlinestatic |
Deletes the text within a specified range and returns the command.
[in] | doc | The opened document object. |
[in] | beg | The starting location (character iterator) of the text to delete. |
[in] | end | The ending location (character iterator) of the text to delete. |
|
inlinestatic |
Deletes a text block from a Layout and returns the command.
[in] | doc | The opened document object. |
[in] | layout | The Layout object containing the text block to delete. |
[in] | block | A reference of the text block to delete. |
|
inlinestatic |
Inserts the specified text at the position and returns the command.
[in] | doc | The opened document object. |
[in] | pos | The iterator representing the position to insert the text at. |
[in] | font_attrs | A reference to the font attributes structure containing information about the inserted text's visual representation. |
[in] | chars | A wide character string reference to the text to insert (i.e. L"insert this text"). |
|
inline |
Checks if the font was substituted during the text command.
|
inlinestatic |
Merges multiple text blocks into a single text block and returns the command.
[in] | doc | The opened document object. |
[in] | begin | The starting location (character iterator) of the first text block to merge. |
[in] | end | The ending location (character iterator) of the other text block to merge. |
|
inlinestatic |
Moves a text block to a new position and returns the command.
[in] | doc | The opened document object. |
[in] | layout | The Layout object containing the text block. |
[in] | block_index | The index of the text block to move. |
[in] | pos | A reference to the new position of the text block being moved. |
|
inlinestatic |
Creates a new text block at a specified position and returns the command.
[in] | doc | The opened document object. |
[in] | layout | The Layout object that will contain the new text block. |
[in] | page_point | The position of the new text block on the page. |
[in] | font_attrs | A reference to the font attributes of the new text block. These include font family, style, format, size, color, escapement, character spacing and scaling etc. |
[in] | para_attrs | A reference to the paragraph attributes of the new text block. These include the alignment of text, line and paragraph spacing, the first line and paragraph indentation. |
|
inlinestatic |
Replaces text within a specified range and returns the command.
[in] | doc | The opened document object. |
[in] | beg | The starting location (character iterator) of the text to replace. |
[in] | end | The ending location (character iterator) of the text to replace. |
[in] | font_attrs | A reference to the font attributes structure containing information about the text to replace visual representation. |
[in] | chars | A wide character string reference to the text to replace with (i.e. L"replace with this text"). |
|
inlinestatic |
Resizes a text block to a new size and returns the command.
[in] | doc | The opened document object. |
[in] | layout | The Layout object containing the text block. |
[in] | block_index | The index of the text block to resize. It identifies block's position within the PDF document. |
[in] | size | A reference to the desired new size of the text block. |
|
inlinestatic |
Rotates a text block by a specified angle and returns the command.
[in] | doc | The opened document object. |
[in] | layout | The Layout object containing the text block to rotate. |
[in] | block_index | The index of the text block to rotate. It identifies block's position within the PDF document. |
[in] | radians | The angle to rotate the text block by (in radians). A positive rotation angle results in a counterclockwise rotation. |
|
inlinestatic |
Scales a text block to a new size and returns the command.
[in] | doc | The opened document object. |
[in] | layout | The Layout object containing the text block to resize. |
[in] | block_index | The index of the text block to scale. It identifies block's position within the PDF document. |
[in] | size | A reference to the desired new scaling factor of the text block. |
|
inlinestatic |
Synchronizes a text block with its content and returns the command.
[in] | doc | The opened document object. |
[in] | layout | The Layout object containing the text block. |
[in] | block_index | The index of the text block to synchronize. It identifies block's position within the PDF document. |
[in] | on_top | 'True' to place the text block on top of other content, 'False' otherwise. |
|
inlinestatic |
Updates all text blocks in a Layout and returns the command.
[in] | doc | The opened document object. |
[in] | layout | The Layout object to update. |