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/concepts/fonts.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,8 +77,16 @@ There are 14 *Type 1* fonts, known as the standard 14 fonts, that are not embedd
77
77
| Symbol|
78
78
| ZapfDingbats|
79
79
80
+
81
+
{{region cs-radpdfprocessing-concepts-fonts_0}}
82
+
83
+
FontBase helvetica = FontsRepository.Helvetica;
84
+
85
+
{{endregion}}
86
+
80
87
>tip These fonts, or their font metrics and suitable substitution fonts, must be available to the consumer application.
81
88
89
+
82
90
## Embedded Fonts
83
91
84
92
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.
93
101
94
102
#### __[C#] Example 1: Register font in .NET Framework application__
@@ -119,12 +127,20 @@ __Example 1__ demonstrates how you can use the RegisterFont() method.
119
127
120
128
>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.
121
129
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
+
122
138
__Example 2__ shows how to create a font using the FontsRepository.
123
139
124
140
125
141
#### __[C#] Example 2: Create FontBase__
126
142
127
-
{{region cs-radpdfprocessing-concepts-fonts_1}}
143
+
{{region cs-radpdfprocessing-concepts-fonts_4}}
128
144
FontBase font;
129
145
bool success = FontsRepository.TryCreateFont(fontFamily, fontStyle, fontWeight, out font);
FixedContentEditor editor = new FixedContentEditor(contentRootElement);
48
+
RadFixedDocument document = new RadFixedDocument();
49
+
var firstPage = document.Pages.AddPage();
50
+
51
+
FixedContentEditor fixedContentEditor = new FixedContentEditor(firstPage);
49
52
{{endregion}}
50
53
51
54
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
55
58
#### __[C#] Example 2: Create FixedContentEditor with a specific position__
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
238
250
239
251
document.AcroForm.FormFields.Add(pushButton);
240
252
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));
243
255
{{endregion}}
244
256
245
257
***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
256
268
257
269
document.AcroForm.FormFields.Add(radio);
258
270
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));
265
277
{{endregion}}
266
278
267
279
## Positioning
@@ -273,13 +285,13 @@ The code in __Example 12__ shows how to manipulate the position of the inserted
273
285
#### __[C#] Example 12: Scale and rotate content__
RadFixedDocumentEditor editor = new RadFixedDocumentEditor(radFixedDocument);
38
+
RadFixedDocument radFixedDocument = new RadFixedDocument();
39
+
RadFixedDocumentEditor radFixedDocumentEditor = new RadFixedDocumentEditor(radFixedDocument);
40
+
41
+
//Use RadFixedDocumentEditor...
42
+
43
+
radFixedDocumentEditor.Dispose();
39
44
{{endregion}}
40
45
41
46
>__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
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.
141
155
142
156
@@ -180,6 +194,15 @@ The character properties that are responsible for the look of the runs are liste
180
194
181
195
*__StrikethroughColor__: The color of the strikethrough.
@@ -257,11 +287,11 @@ You can easily insert list items with __RadFixedDocumentEditor__. The first thin
257
287
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:
0 commit comments