PDF SDK Documentation

Comprehensive Guide for Developers: Features, Integration, and API Reference

Loading...
Searching...
No Matches
PDF::TextEdit::TextCommand Class 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>

Inheritance diagram for PDF::TextEdit::TextCommand:

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
 
TextCommandoperator= (const TextCommand &rhs) noexcept
 
 TextCommand (TextCommand &&rhs) noexcept
 
TextCommandoperator= (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 &para_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 &para_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.
 

Detailed Description

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.

Member Function Documentation

◆ ChangeCharSpacing()

TextCommand PDF::TextEdit::TextCommand::ChangeCharSpacing ( Document doc,
CharIterator begin,
CharIterator end,
float char_spacing )
inlinestatic

Changes the character spacing of text within a specified range and returns the command.

Parameters
[in]docThe opened document object.
[in]beginThe starting location (character iterator) of the text range to change the character spacing of.
[in]endThe ending location (character iterator) of the text range to change the character spacing of.
[in]char_spacingThe 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.
Returns
The TextCommand object representing the executed change character spacing command.

◆ ChangeEscapement()

TextCommand PDF::TextEdit::TextCommand::ChangeEscapement ( Document doc,
CharIterator begin,
CharIterator end,
PDTEscapement escapment )
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.

Parameters
[in]docThe opened document object.
[in]beginThe starting location (character iterator) of the text range to change the escapement of.
[in]endThe ending location (character iterator) of the text range to change the escapement of.
[in]escapmentThe escapement to change to. One of - none, subscript, superscript.
See also
PDTEscapement.
Returns
The TextCommand object representing the executed change escapement command.

◆ ChangeFont()

TextCommand PDF::TextEdit::TextCommand::ChangeFont ( Document doc,
CharIterator beg,
CharIterator end,
PDAtom font_family,
PDAtom font_format )
inlinestatic

Changes the font of text within a specified range and returns the command.

Parameters
[in]docThe opened document object.
[in]begThe starting location (character iterator) of the text range to change the font.
[in]endThe ending location (character iterator) of the text range to change the font.
[in]font_familyThe font family to change to.
See also
PDAtom.
Parameters
[in]font_formatThe font format to change to.
See also
PDAtom.
Returns
The TextCommand object representing the executed change font command.

◆ ChangeFontColor()

TextCommand PDF::TextEdit::TextCommand::ChangeFontColor ( Document doc,
CharIterator beg,
CharIterator end,
PDColorValue font_color )
inlinestatic

Changes the font color of text within a specified range and returns the command.

Parameters
docThe opened document object.
begThe starting location (character iterator) of the text range to change the font color of.
endThe ending location (character iterator) of the text range to change the font color of.
font_colorThe font color to change to. A 32-bit ARGB value each field using 8-bits.
Returns
The TextCommand object representing the executed change font color command.

◆ ChangeFontSize()

TextCommand PDF::TextEdit::TextCommand::ChangeFontSize ( Document doc,
CharIterator beg,
CharIterator end,
float font_size )
inlinestatic

Changes the font size of text within a specified range and returns the command.

Parameters
[in]docThe opened document object.
[in]begThe starting location (character iterator) of the text range to change the font size of.
[in]endThe ending location (character iterator) of the text range to change the font size of.
[in]font_sizeThe font size to change to.
Returns
The TextCommand object representing the executed change font size command.

◆ ChangeFontStyle()

TextCommand PDF::TextEdit::TextCommand::ChangeFontStyle ( Document doc,
CharIterator beg,
CharIterator end,
PDFontStyle font_style )
inlinestatic

Changes the font style of text within a specified range and returns the command.

Parameters
[in]docThe opened document object.
[in]begThe starting location (character iterator) of the text range to change the font style of.
[in]endThe ending location (character iterator) of the text range to change the font style of.
[in]font_styleThe font style to change to.
See also
PDFontStyle.
Returns
The TextCommand object representing the executed change font style command.

◆ ChangeHorzScaling()

TextCommand PDF::TextEdit::TextCommand::ChangeHorzScaling ( Document doc,
CharIterator begin,
CharIterator end,
float horz_scaling )
inlinestatic

Changes the horizontal scaling (horizontal stretch) of text within a specified range and returns the command.

Parameters
[in]docThe opened document object.
[in]beginThe beginning location (character iterator) of the text range to change the horizontal scaling of.
[in]endThe ending location (character iterator) of the text range to change the horizontal scaling of.
[in]horz_scalingThe 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.
Returns
The TextCommand object representing the executed change horizontal scaling command.

◆ ChangeListLevel()

TextCommand PDF::TextEdit::TextCommand::ChangeListLevel ( Document doc,
CharIterator begin,
CharIterator end,
int change )
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.

Parameters
[in]docThe opened document object.
[in]beginThe starting location (character iterator) of the text range whose list level is to be altered.
[in]endThe ending location (character iterator) of the text range whose list level is to be altered.
[in]changeThe desired list level to change to.
Returns
The TextCommand object representing the executed change list level command.

◆ ChangeListStyle()

TextCommand PDF::TextEdit::TextCommand::ChangeListStyle ( Document doc,
CharIterator begin,
CharIterator end,
const PDTListLevelStyle & style )
inlinestatic

Changes the list style of text within a specified range and returns the command.

Parameters
[in]docThe opened document object.
[in]beginThe starting location (character iterator) of the text range to change the list style.
[in]endThe ending location (character iterator) of the text range to change the list style.
[in]styleA reference to the list level style to change to. This includes the labeling convention for list items, the font family, style, format etc.
See also
PDTListLevelStyle.
Returns
The TextCommand object representing the executed change list style command.

◆ ChangeParaAttrs()

TextCommand PDF::TextEdit::TextCommand::ChangeParaAttrs ( Document doc,
CharIterator iter,
const PDTParaAttrs & para_attrs )
inlinestatic

Changes the paragraph attributes of text for a specific paragraph and returns the command.

Parameters
[in]docThe opened document object.
[in]iterThe location (character iterator) representing the paragraph of interest.
[in]para_attrsA reference to the paragraph attributes to change to. These include the alignment of text, line and paragraph spacing, the first line and paragraph indentation.
See also
PDTParaAttrs
Returns
The TextCommand object representing the executed change paragraph attributes command.

◆ DeleteText()

TextCommand PDF::TextEdit::TextCommand::DeleteText ( Document doc,
CharIterator beg,
CharIterator end )
inlinestatic

Deletes the text within a specified range and returns the command.

Parameters
[in]docThe opened document object.
[in]begThe starting location (character iterator) of the text to delete.
[in]endThe ending location (character iterator) of the text to delete.
Returns
The TextCommand object representing the executed delete text command.

◆ DeleteTextBlock()

TextCommand PDF::TextEdit::TextCommand::DeleteTextBlock ( Document doc,
Layout layout,
const TextBlock & block )
inlinestatic

Deletes a text block from a Layout and returns the command.

Parameters
[in]docThe opened document object.
[in]layoutThe Layout object containing the text block to delete.
[in]blockA reference of the text block to delete.
Returns
The TextCommand object representing the executed delete text block command.

◆ InsertText()

TextCommand PDF::TextEdit::TextCommand::InsertText ( Document doc,
CharIterator pos,
const PDTFontAttrs & font_attrs,
const std::wstring & chars )
inlinestatic

Inserts the specified text at the position and returns the command.

Parameters
[in]docThe opened document object.
[in]posThe iterator representing the position to insert the text at.
[in]font_attrsA reference to the font attributes structure containing information about the inserted text's visual representation.
See also
PDTFontAttrs.
Parameters
[in]charsA wide character string reference to the text to insert (i.e. L"insert this text").
Returns
The TextCommand object representing the executed insert text command.

◆ IsFontSubstituted()

bool PDF::TextEdit::TextCommand::IsFontSubstituted ( ) const
inline

Checks if the font was substituted during the text command.

Returns
True if the font was substituted, false otherwise.

◆ MergeTextBlocks()

TextCommand PDF::TextEdit::TextCommand::MergeTextBlocks ( Document doc,
CharIterator begin,
CharIterator end )
inlinestatic

Merges multiple text blocks into a single text block and returns the command.

Parameters
[in]docThe opened document object.
[in]beginThe starting location (character iterator) of the first text block to merge.
[in]endThe ending location (character iterator) of the other text block to merge.
Returns
The TextCommand object representing the executed merge text blocks command.

◆ MoveTextBlock()

TextCommand PDF::TextEdit::TextCommand::MoveTextBlock ( Document doc,
Layout layout,
size_t block_index,
const PointF & pos )
inlinestatic

Moves a text block to a new position and returns the command.

Parameters
[in]docThe opened document object.
[in]layoutThe Layout object containing the text block.
[in]block_indexThe index of the text block to move.
[in]posA reference to the new position of the text block being moved.
Returns
The TextCommand object representing the executed move text block command.

◆ NewTextBlock()

TextCommand PDF::TextEdit::TextCommand::NewTextBlock ( Document doc,
Layout layout,
const PointF & page_point,
const PDTFontAttrs & font_attrs,
const PDTParaAttrs & para_attrs )
inlinestatic

Creates a new text block at a specified position and returns the command.

Parameters
[in]docThe opened document object.
[in]layoutThe Layout object that will contain the new text block.
[in]page_pointThe position of the new text block on the page.
See also
PointF.
Parameters
[in]font_attrsA reference to the font attributes of the new text block. These include font family, style, format, size, color, escapement, character spacing and scaling etc.
See also
PDTFontAttrs.
Parameters
[in]para_attrsA 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.
See also
PDTParaAttrs
Returns
The TextCommand object representing the executed new text block command.

◆ ReplaceText()

TextCommand PDF::TextEdit::TextCommand::ReplaceText ( Document doc,
CharIterator beg,
CharIterator end,
const PDTFontAttrs & font_attrs,
const std::wstring & chars )
inlinestatic

Replaces text within a specified range and returns the command.

Parameters
[in]docThe opened document object.
[in]begThe starting location (character iterator) of the text to replace.
[in]endThe ending location (character iterator) of the text to replace.
[in]font_attrsA reference to the font attributes structure containing information about the text to replace visual representation.
See also
PDTFontAttrs.
Parameters
[in]charsA wide character string reference to the text to replace with (i.e. L"replace with this text").
Returns
The TextCommand object representing the executed replace text command.

◆ ResizeTextBlock()

TextCommand PDF::TextEdit::TextCommand::ResizeTextBlock ( Document doc,
Layout layout,
size_t block_index,
const SizeF & size )
inlinestatic

Resizes a text block to a new size and returns the command.

Parameters
[in]docThe opened document object.
[in]layoutThe Layout object containing the text block.
[in]block_indexThe index of the text block to resize. It identifies block's position within the PDF document.
[in]sizeA reference to the desired new size of the text block.
See also
SizeF.
Returns
The TextCommand object representing the executed resize text block command.

◆ RotateTextBlock()

TextCommand PDF::TextEdit::TextCommand::RotateTextBlock ( Document doc,
Layout layout,
size_t block_index,
float radians )
inlinestatic

Rotates a text block by a specified angle and returns the command.

Parameters
[in]docThe opened document object.
[in]layoutThe Layout object containing the text block to rotate.
[in]block_indexThe index of the text block to rotate. It identifies block's position within the PDF document.
[in]radiansThe angle to rotate the text block by (in radians). A positive rotation angle results in a counterclockwise rotation.
Returns
The TextCommand object representing the executed rotate text block command.

◆ ScaleTextBlock()

TextCommand PDF::TextEdit::TextCommand::ScaleTextBlock ( Document doc,
Layout layout,
size_t block_index,
const SizeF & size )
inlinestatic

Scales a text block to a new size and returns the command.

Parameters
[in]docThe opened document object.
[in]layoutThe Layout object containing the text block to resize.
[in]block_indexThe index of the text block to scale. It identifies block's position within the PDF document.
[in]sizeA reference to the desired new scaling factor of the text block.
See also
SizeF.
Returns
The TextCommand object representing the executed scale TextBlock command.

◆ SyncWithContent()

TextCommand PDF::TextEdit::TextCommand::SyncWithContent ( Document doc,
Layout layout,
size_t block_index,
bool on_top )
inlinestatic

Synchronizes a text block with its content and returns the command.

Parameters
[in]docThe opened document object.
[in]layoutThe Layout object containing the text block.
[in]block_indexThe 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.
Returns
The TextCommand object representing the executed synchronize text block command.

◆ UpdateTextBlocks()

TextCommand PDF::TextEdit::TextCommand::UpdateTextBlocks ( Document doc,
Layout layout )
inlinestatic

Updates all text blocks in a Layout and returns the command.

Parameters
[in]docThe opened document object.
[in]layoutThe Layout object to update.
Returns
The TextCommand object representing the executed update TextBlocks command.

The documentation for this class was generated from the following file: