Skip to content

Commit 943845b

Browse files
Merge pull request #417 from telerik/yoan/docs-feedback
Yoan/docs feedback
2 parents 99f8ba0 + 6441deb commit 943845b

File tree

17 files changed

+239
-128
lines changed

17 files changed

+239
-128
lines changed

knowledge-base/quote-worksheet-values-and-csv-export.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ using (StreamWriter writer = new StreamWriter(stream))
6464
}
6565
}
6666
```
67-
![Before - After quoting and exporting to CSV ](images/quotedCsvValus.png)
67+
![Before - After quoting and exporting to CSV ](images/quoted-csv-values.png)
6868

6969
## See Also
7070

libraries/radpdfprocessing/concepts/fonts.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,16 @@ There are 14 *Type 1* fonts, known as the standard 14 fonts, that are not embedd
7777
| Symbol|
7878
| ZapfDingbats|
7979

80+
81+
{{region cs-radpdfprocessing-concepts-fonts_0}}
82+
83+
FontBase helvetica = FontsRepository.Helvetica;
84+
85+
{{endregion}}
86+
8087
>tip These fonts, or their font metrics and suitable substitution fonts, must be available to the consumer application.
8188
89+
8290
## Embedded Fonts
8391

8492
All fonts, which are not included in the 14 standard ones, should be **embedded** in the PDF document. Otherwise, the result may be unpredictable when the document is rendered. In __RadPdfProcessing__ you have the ability to embed fonts following the approaches described below.
@@ -93,7 +101,7 @@ __Example 1__ demonstrates how you can use the RegisterFont() method.
93101

94102
#### __[C#] Example 1: Register font in .NET Framework application__
95103

96-
{{region cs-radpdfprocessing-concepts-fonts_0}}
104+
{{region cs-radpdfprocessing-concepts-fonts_1}}
97105

98106
// Read the font file
99107
byte[] fontData = File.ReadAllBytes("some-font.ttf");
@@ -119,12 +127,20 @@ __Example 1__ demonstrates how you can use the RegisterFont() method.
119127

120128
>tip Each registered font can be obtained from the font repository as __FontBase__ object and applied to a __[TextFragment]({%slug radpdfprocessing-model-textfragment%})__ through its __Font__ property.
121129
130+
{{region cs-radpdfprocessing-concepts-fonts_3}}
131+
132+
FontBase courier = FontsRepository.Courier;
133+
TextFragment textFragment = new TextFragment();
134+
textFragment.Font = courier;
135+
136+
{{endregion}}
137+
122138
__Example 2__ shows how to create a font using the FontsRepository.
123139

124140

125141
#### __[C#] Example 2: Create FontBase__
126142

127-
{{region cs-radpdfprocessing-concepts-fonts_1}}
143+
{{region cs-radpdfprocessing-concepts-fonts_4}}
128144
FontBase font;
129145
bool success = FontsRepository.TryCreateFont(fontFamily, fontStyle, fontWeight, out font);
130146
{{endregion}}

libraries/radpdfprocessing/editing/fixedcontenteditor.md

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ __FixedContentEditor__ is always associated with a single [RadFixedPage]({%slug
4545
#### __[C#] Example 1: Create FixedContentEditor__
4646

4747
{{region cs-radpdfprocessing-editing-fixedcontenteditor_0}}
48-
FixedContentEditor editor = new FixedContentEditor(contentRootElement);
48+
RadFixedDocument document = new RadFixedDocument();
49+
var firstPage = document.Pages.AddPage();
50+
51+
FixedContentEditor fixedContentEditor = new FixedContentEditor(firstPage);
4952
{{endregion}}
5053

5154
The editor maintains an internal [Position]({%slug radpdfprocessing-concepts-position%}) inside the content root element. When a new element is created, its position is being set to the current position of the editor. The initial position of the editor can be specified when it is created.
@@ -55,7 +58,16 @@ __Example 2__ demonstrates how you can create a FixedContentEditor with a specif
5558
#### __[C#] Example 2: Create FixedContentEditor with a specific position__
5659

5760
{{region cs-radpdfprocessing-editing-fixedcontenteditor_1}}
58-
FixedContentEditor editor = new FixedContentEditor(contentRootElement, initialPosition);
61+
MatrixPosition matrixPosition = new MatrixPosition();
62+
matrixPosition.Translate(20, 20); // Translates the position by (20, 20)
63+
matrixPosition.Translate(30, 30); // Translates the position by (30, 30).
64+
65+
SimplePosition simplePosition = new SimplePosition();
66+
simplePosition.Translate(20, 20); // Translates the position by (20, 20).
67+
simplePosition.Translate(30, 30); // Translates the position by (30, 30) overwriting the previous translations.
68+
69+
FixedContentEditor simplePositionfixedContentEditor = new FixedContentEditor(firstPage,matrixPosition);
70+
FixedContentEditor matrixPositionfixedContentEditor = new FixedContentEditor(firstPage,matrixPosition);
5971
{{endregion}}
6072

6173
## Inserting Elements
@@ -69,7 +81,7 @@ Inserting a [TextFragment]({%slug radpdfprocessing-model-textfragment%}) can be
6981
#### __[C#] Example 3: Insert TextFragment__
7082

7183
{{region cs-radpdfprocessing-editing-fixedcontenteditor_2}}
72-
editor.DrawText("First text fragment.");
84+
fixedContentEditor.DrawText("First text fragment.");
7385
{{endregion}}
7486

7587
__Figure 1__ shows the result of __Example 3__.
@@ -90,7 +102,7 @@ __Example 4__ shows how you can use the __Block__ object to draw a paragraph.
90102
Block block = new Block();
91103
block.InsertText("First sentence.");
92104
block.InsertText("Second sentence.");
93-
editor.DrawBlock(block);
105+
fixedContentEditor.DrawBlock(block);
94106
{{endregion}}
95107

96108
__Figure 2__ shows the result of __Example 4__.
@@ -119,7 +131,7 @@ __Example 5__ shows how you can add an image created from a Stream.
119131
{{region cs-radpdfprocessing-editing-fixedcontenteditor_4}}
120132
using (Stream stream = this.GetResourceStream("Telerik_logo.jpg"))
121133
{
122-
editor.DrawImage(stream, new Size(118, 28));
134+
fixedContentEditor.DrawImage(stream, new Size(118, 28));
123135
}
124136
{{endregion}}
125137

@@ -141,7 +153,7 @@ __Example 6__ shows how you can add an ellipse using one of FixedContentEditor's
141153
#### __[C#] Example 6: Insert ellipse__
142154

143155
{{region cs-radpdfprocessing-editing-fixedcontenteditor_5}}
144-
editor.DrawEllipse(new Point(250, 70), 136, 48);
156+
fixedContentEditor.DrawEllipse(new Point(250, 70), 136, 48);
145157
{{endregion}}
146158

147159
### Inserting Clipping
@@ -167,7 +179,7 @@ When a new clipping is pushed, it is set as a clipping to the current clipping i
167179

168180
using (editor.PushClipping(new Rect(new Point(0, 0), visisibleTextSize)))
169181
{
170-
editor.DrawText(text);
182+
fixedContentEditor.DrawText(text);
171183
}
172184
{{endregion}}
173185

@@ -201,8 +213,8 @@ __Example 8__ generates a table and draws it in some fixed size.
201213
RadFixedDocument document = new RadFixedDocument();
202214
RadFixedPage page = document.Pages.AddPage();
203215
FixedContentEditor editor = new FixedContentEditor(page);
204-
editor.Position.Translate(10, 10);
205-
editor.DrawTable(table, new Size(180, double.PositiveInfinity));
216+
fixedContentEditor.Position.Translate(10, 10);
217+
fixedContentEditor.DrawTable(table, new Size(180, double.PositiveInfinity));
206218
{{endregion}}
207219

208220
#### The table created in Example 8
@@ -217,7 +229,7 @@ With the FixedContentEditor class you can insert a Form (Form-XObject) element.
217229

218230
#### __[C#] Example 9: Insert a form__
219231
{{region cs-radpdfprocessing-editing-fixedcontenteditor_9}}
220-
editor.DrawForm(formSource);
232+
fixedContentEditor.DrawForm(formSource);
221233
{{endregion}}
222234

223235
There are two more overloads of DrawForm() that enable you to pass the size that should be used for the form.
@@ -238,8 +250,8 @@ The Widget annotations allow you visualize the content of a FormField. With the
238250

239251
document.AcroForm.FormFields.Add(pushButton);
240252

241-
editor.Position.Translate(20, 450);
242-
editor.DrawWidget(pushButton, new Size(100, 20));
253+
fixedContentEditor.Position.Translate(20, 450);
254+
fixedContentEditor.DrawWidget(pushButton, new Size(100, 20));
243255
{{endregion}}
244256

245257
* **DrawWidget(RadioButtonField parentField, RadioOption option, Size annotationSize)**: Creates new [RadioButtonWidget]({%slug radpdfprocessing-model-annotations-widgets%}#radiobuttonwidget-class) and draws the widget with the specified annotation size. This method will add widget only in cases when the root of the FixedContentEditor supports annotations. The second parameter represents the option that should be visualized by the widget.
@@ -256,12 +268,12 @@ The Widget annotations allow you visualize the content of a FormField. With the
256268

257269
document.AcroForm.FormFields.Add(radio);
258270
259-
editor.Position.Translate(20, 410);
260-
editor.DrawWidget(radio, radio.Options[0], new Size(20, 20));
261-
editor.Position.Translate(50, 410);
262-
editor.DrawWidget(radio, radio.Options[1], new Size(20, 20));
263-
editor.Position.Translate(80, 410);
264-
editor.DrawWidget(radio, radio.Options[2], new Size(20, 20));
271+
fixedContentEditor.Position.Translate(20, 410);
272+
fixedContentEditor.DrawWidget(radio, radio.Options[0], new Size(20, 20));
273+
fixedContentEditor.Position.Translate(50, 410);
274+
fixedContentEditor.DrawWidget(radio, radio.Options[1], new Size(20, 20));
275+
fixedContentEditor.Position.Translate(80, 410);
276+
fixedContentEditor.DrawWidget(radio, radio.Options[2], new Size(20, 20));
265277
{{endregion}}
266278

267279
## Positioning
@@ -273,13 +285,13 @@ The code in __Example 12__ shows how to manipulate the position of the inserted
273285
#### __[C#] Example 12: Scale and rotate content__
274286

275287
{{region cs-radpdfprocessing-editing-fixedcontenteditor_7}}
276-
editor.Position.Scale(1.5, 0.5);
277-
editor.Position.Rotate(10);
278-
editor.DrawText("Image:");
279-
editor.Position.Translate(0, 20);
288+
fixedContentEditor.Position.Scale(1.5, 0.5);
289+
fixedContentEditor.Position.Rotate(10);
290+
fixedContentEditor.DrawText("Image:");
291+
fixedContentEditor.Position.Translate(0, 20);
280292
using (Stream stream = this.GetResourceStream("Telerik_logo.jpg"))
281293
{
282-
editor.DrawImage(stream, new Size(118, 28));
294+
fixedContentEditor.DrawImage(stream, new Size(118, 28));
283295
}
284296
{{endregion}}
285297

libraries/radpdfprocessing/editing/radfixeddocumenteditor.md

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ __Example 1__ demonstrates how a RadFixedDocumentEditor instance can be created.
3535
#### __[C#] Example 1: Create RadFixedDocumentEditor__
3636

3737
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_0}}
38-
RadFixedDocumentEditor editor = new RadFixedDocumentEditor(radFixedDocument);
38+
RadFixedDocument radFixedDocument = new RadFixedDocument();
39+
RadFixedDocumentEditor radFixedDocumentEditor = new RadFixedDocumentEditor(radFixedDocument);
40+
41+
//Use RadFixedDocumentEditor...
42+
43+
radFixedDocumentEditor.Dispose();
3944
{{endregion}}
4045

4146
>__RadFixedDocumentEditor__ inherits from __IDisposable__ so it should be properly disposed when the document is created. Otherwise, some of the content may not be finished, i.e. it might not appear on the PDF document.
@@ -61,6 +66,10 @@ The section properties are responsible for the page size, margins and orientatio
6166
* __Rotate180__: The page is rotated to 180°.
6267
* __Rotate270__: The page is rotated to 270°.
6368
69+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_1}}
70+
radFixedDocumentEditor.SectionProperties.PageSize = new Size(100,100);
71+
radFixedDocumentEditor.SectionProperties.PageRotation = Telerik.Windows.Documents.Fixed.Model.Data.Rotation.Rotate90;
72+
{{endregion}}
6473

6574
### Starting New Section
6675

@@ -72,8 +81,8 @@ Adding an additional section is achieved with the __InsertSectionBreak()__ metho
7281

7382
#### __[C#] Example 2: Start a section__
7483

75-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_1}}
76-
editor.InsertSectionBreak();
84+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_2}}
85+
radFixedDocumentEditor.InsertSectionBreak();
7786
{{endregion}}
7887

7988

@@ -84,8 +93,8 @@ Adding an additional section is achieved with the __InsertSectionBreak()__ metho
8493
All pages that have the same __SectionProperties__ are part of the current section. To start a new page, you can use the following code:
8594

8695
#### __[C#] Example 3: Start new page__
87-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_2}}
88-
editor.InsertPageBreak();
96+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_3}}
97+
radFixedDocumentEditor.InsertPageBreak();
8998
{{endregion}}
9099

91100
## Paragraphs
@@ -120,6 +129,12 @@ Similar to the section properties, paragraph has its own properties that are res
120129

121130
* __ListLevel__: The list level the paragraph belongs to.
122131

132+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_4}}
133+
radFixedDocumentEditor.ParagraphProperties.SpacingAfter = 10;
134+
radFixedDocumentEditor.ParagraphProperties.LineSpacingType = HeightType.Auto;
135+
adFixedDocumentEditor.ParagraphProperties.BackgroundColor = new RgbColor(0, 100, 0);
136+
radFixedDocumentEditor.ParagraphProperties.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
137+
{{endregion}}
123138

124139
### Starting New Paragraph
125140

@@ -131,12 +146,11 @@ In order to start a new paragraph, use the code in __Example 4__.
131146

132147
#### __[C#] Example 4: Start a paragraph__
133148

134-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_3}}
135-
editor.InsertParagraph();
149+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_5}}
150+
radFixedDocumentEditor.InsertParagraph();
136151
{{endregion}}
137152

138153

139-
140154
The result of this method is that a new paragraph is started and it uses the current paragraph properties. Until a new paragraph is started, changes in the paragraph properties are not applied.
141155

142156

@@ -180,6 +194,15 @@ The character properties that are responsible for the look of the runs are liste
180194

181195
* __StrikethroughColor__: The color of the strikethrough.
182196

197+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_6}}
198+
radFixedDocumentEditor.CharacterProperties.FontSize = 12;
199+
radFixedDocumentEditor.CharacterProperties.Font = FontsRepository.Courier;
200+
radFixedDocumentEditor.CharacterProperties.HighlightColor = new RgbColor(10, 100, 80);
201+
radFixedDocumentEditor.CharacterProperties.BaselineAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.BaselineAlignment.Subscript;
202+
radFixedDocumentEditor.CharacterProperties.UnderlinePattern = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.UnderlinePattern.Single;
203+
{{endregion}}
204+
205+
>In order for the character properties to be respected, make sure to set them __before__ inserting the Run.
183206
184207
### Inserting a Run
185208

@@ -188,9 +211,9 @@ There are a number of overloads that insert a run. The code snippet in __Example
188211

189212
#### __[C#] Example 5: Insert run__
190213

191-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_4}}
192-
editor.InsertRun("text");
193-
editor.InsertRun(fontFamily, "text");
214+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_7}}
215+
radFixedDocumentEditor.InsertRun("text");
216+
radFixedDocumentEditor.InsertRun(new FontFamily("Helvetica"),"text");
194217
{{endregion}}
195218

196219

@@ -204,12 +227,11 @@ The code in __Example 6__ inserts a new run and a line break after it.
204227

205228
#### __[C#] Example 6: Insert run and line break__
206229

207-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_5}}
208-
editor.InsertLine("Line of text");
230+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_8}}
231+
radFixedDocumentEditor.InsertLine("Line of text");
209232
{{endregion}}
210233

211234

212-
213235
### Images
214236

215237
Image inline is a combination of an [ImageSource]({%slug radpdfprocessing-model-imagesource%}) object and its desired size.
@@ -221,9 +243,10 @@ You can insert image inline using one of the following methods:
221243

222244
#### __[C#] Example 7: Insert image__
223245

224-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_6}}
225-
editor.InsertImageInline(imageSource);
226-
editor.InsertImageInline(imageSource, size);
246+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_9}}
247+
ImageSource imageSource = new ImageSource(new FileStream("image.jpeg", FileMode.Open));
248+
radFixedDocumentEditor.InsertImageInline(imageSource);
249+
radFixedDocumentEditor.InsertImageInline(imageSource, new Size(100, 100));
227250
{{endregion}}
228251

229252
## Tables
@@ -233,8 +256,12 @@ The __Table__ class implements the __IBlockElement__ interface and an instance o
233256

234257
#### __[C#] Example 8: Insert table__
235258

236-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_7}}
237-
editor.InsertTable(table);
259+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_10}}
260+
Table table = new Table();
261+
TableRow firstRow = table.Rows.AddTableRow();
262+
firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cellText");
263+
264+
radFixedDocumentEditor.InsertTable(table);
238265
{{endregion}}
239266

240267
For more detailed information on tables, check the [Table]({%slug radpdfprocessing-editing-table%}) documentation article.
@@ -245,8 +272,11 @@ The [IBlockElement](https://docs.telerik.com/devtools/document-processing/api/Te
245272

246273
#### __[C#] Example 9: Insert Block element__
247274

248-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_8}}
249-
editor.InsertBlock(blockElement);
275+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_11}}
276+
Block block = new Block();
277+
block.InsertText("Text");
278+
279+
radFixedDocumentEditor.InsertBlock(block);
250280
{{endregion}}
251281

252282

@@ -257,11 +287,11 @@ You can easily insert list items with __RadFixedDocumentEditor__. The first thin
257287
The following code snippet shows how to add a new list to __RadFixedDocumentEditor’s ListCollection__ and after that insert a paragraph with the corresponding list properties:
258288

259289
#### __[C#] Example 10: Insert list__
260-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_9}}
261-
List list = editor.Lists.AddList(ListTemplateType.NumberedDefault);
262-
editor.ParagraphProperties.ListId = list.Id;
263-
editor.ParagraphProperties.ListLevel = 0;
264-
editor.InsertParagraph();
290+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_12}}
291+
List list = radFixedDocumentEditor.Lists.AddList(ListTemplateType.NumberedDefault);
292+
radFixedDocumentEditor.ParagraphProperties.ListId = list.Id;
293+
radFixedDocumentEditor.ParagraphProperties.ListLevel = 0;
294+
radFixedDocumentEditor.InsertParagraph();
265295
{{endregion}}
266296

267297
More detailed information about lists is available in the [List documentation article]({%slug radpdfprocessing-editing-list%}).
@@ -271,8 +301,8 @@ More detailed information about lists is available in the [List documentation ar
271301
With the RadFixedDocumentEditor class you can insert a Form (Form-XObject) element.
272302

273303
#### __[C#] Example 11: Insert a form__
274-
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_10}}
275-
editor.InsertFormInline(formSource);
304+
{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_13}}
305+
radFixedDocumentEditor.InsertFormInline(formSource);
276306
{{endregion}}
277307

278308
There is an additional overload of InsertFormInline() that enables you to pass the size that should be used for the form.

0 commit comments

Comments
 (0)