You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libraries/radpdfprocessing/model/textfragment.md
+28-25Lines changed: 28 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -8,45 +8,48 @@ position: 3
8
8
---
9
9
10
10
# TextFragment
11
-
12
-
13
-
14
-
__TextFragment__ is content element that represents а single-line text object.
15
-
11
+
__TextFragment__ is content element that represents а single-line text object.
16
12
17
13
*[Inserting a TextFragment](#inserting-a-textfragment)
18
14
19
-
*[Modifying a TextFragment](#modifying-a-textfragment)
20
-
15
+
*[Modifying a TextFragment](#modifying-a-textfragment)
21
16
22
17
## Inserting a TextFragment
23
18
24
-
__TextFragment__ is a content element that can be added in the __Content__ collection of a __IContainerElement__ such as [RadFixedPage]({%slug radpdfprocessing-model-radfixedpage%}). There are several approaches that can be adopted.
25
-
19
+
__TextFragment__ is a content element that can be added in the __Content__ collection of a __IContainerElement__ such as [RadFixedPage]({%slug radpdfprocessing-model-radfixedpage%}). There are several approaches that can be adopted:
26
20
27
-
__Example 1__ shows how you can initialize a TextFragment object and add it to a previously defined container.
28
-
21
+
* Create a TextFragment and add it to a page container
22
+
* Use one of the factory methods of the __ContentElementCollection__ to create a new text fragment and insert it into the respective container
23
+
24
+
Both methods return the actual TextFragment instance so you can modify it.
29
25
30
26
#### __[C#] Example 1: Create TextFragment and add it to container__
__Example 2__ demonstrates how to use one of the factory methods of the __ContentElementCollection__, which create new text fragment and insert it into the respective container. Both methods return the actual TextFragment instance so you can modify it.
40
-
41
-
42
-
#### __[C#] Example 2: Add TextFragment to container__
SimplePosition simplePosition2 = new SimplePosition();
42
+
simplePosition2.Translate(20, 120);
43
+
TextFragment textFragment2 = new TextFragment("Document Processing Libraries");
44
+
textFragment2.CharacterSpacing = 10;
45
+
textFragment2.WordSpacing = 20;
46
+
textFragment2.Position = simplePosition2;
47
+
page.Content.Add(textFragment2);
47
48
{{endregion}}
48
49
50
+
>caption Inserted TextFragments
49
51
52
+

50
53
51
54
>tip__TextFragment__ represents a single line of text. In order to make your text "flows" in a document you should make sure all fragments you add can fit in a line or you can use [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}).
0 commit comments