diff --git a/libraries/radpdfprocessing/concepts/clipping.md b/libraries/radpdfprocessing/concepts/clipping.md
index e44d0d76..6915400c 100644
--- a/libraries/radpdfprocessing/concepts/clipping.md
+++ b/libraries/radpdfprocessing/concepts/clipping.md
@@ -27,10 +27,7 @@ __Example 1__ demonstrates how you can create a Clipping element and assign a __
#### __[C#] Example 1: Create clipping__
-{{region cs-radpdfprocessing-concepts-clipping_0}}
- Clipping clipping = new Clipping();
- clipping.Clip = new RectangleGeometry(new Rect(5, 5, 50, 50));
-{{endregion}}
+
@@ -44,10 +41,7 @@ __Example 2__ demonstrates how to clip an image using the Clipping created in __
#### __[C#] Example 2: Use clipping__
-{{region cs-radpdfprocessing-concepts-clipping_1}}
- Image image = container.Content.AddImage(imageSource);
- image.Clipping = clipping;
-{{endregion}}
+
diff --git a/libraries/radpdfprocessing/concepts/cmaps.md b/libraries/radpdfprocessing/concepts/cmaps.md
index 1d8fd7dd..443c928b 100644
--- a/libraries/radpdfprocessing/concepts/cmaps.md
+++ b/libraries/radpdfprocessing/concepts/cmaps.md
@@ -24,13 +24,7 @@ The **Telerik[.Windows].Documents.CMapUtils.dll** assembly provides a default im
>To use this functionality, you must add a reference to the **Telerik[.Windows].Documents.CMapUtils.dll**.
#### [C#] Example 1: Register default CMapsProvider
-{{region radpdfprocessing-concepts-cmap_0}}
- // For .NET Framework
- Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.PredefinedCMapsProvider = new Telerik.Windows.Documents.CMapUtils.PredefinedCMapsProvider();
-
- // For .NET Standard
- Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.PredefinedCMapsProvider = new Telerik.Documents.CMapUtils.PredefinedCMapsProvider();
-{{endregion}}
+
After registering the **PredefinedCMapsProvider** class, you will be able to import any document containing a predefined CMap table.
diff --git a/libraries/radpdfprocessing/concepts/colors-and-color-spaces.md b/libraries/radpdfprocessing/concepts/colors-and-color-spaces.md
index 2c966c70..09f768b4 100644
--- a/libraries/radpdfprocessing/concepts/colors-and-color-spaces.md
+++ b/libraries/radpdfprocessing/concepts/colors-and-color-spaces.md
@@ -34,11 +34,7 @@ __Example 1__ demonstrates how you can create an RgbColor and assign it as Fill
#### __[C#] Example 1: Create RgbColor__
-{{region cs-radpdfprocessing-concepts-colors-and-color-spaces_0}}
- RgbColor magenta = new RgbColor(255, 0, 255);
- Path path = new Path();
- path.Fill = magenta;
-{{endregion}}
+
### CmykColor
@@ -51,20 +47,7 @@ Represents a CMYK (cyan, magenta, yellow, key) color. The CmykColor class was in
#### Create CmykColor
-```csharp
- RadFixedDocument document = new RadFixedDocument();
- RadFixedPage page = document.Pages.AddPage();
- FixedContentEditor containerEditor = new FixedContentEditor(page);
-
- double c = 0.46;
- double m = 0.3;
- double y = 0.76;
- double k = 0.12;
-
- CmykColor cmykColor = new CmykColor(c, m, y, k);
- containerEditor.GraphicProperties.FillColor = cmykColor;
- containerEditor.DrawRectangle(new Rect(10, 10, 48, 29));
-```
+

@@ -98,21 +81,13 @@ The __Gradient__ class is inherited by the following classes:
#### __[C#] Example 2: Create LinearGradient__
- {{region cs-radpdfprocessing-concepts-colors-and-color-spaces_1}}
- FixedContentEditor containerEditor = new FixedContentEditor(container);
-
- LinearGradient linearGradient = new LinearGradient(new Point(0, 0), new Point(30, 30));
- linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 207, 0), 0));
- linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 102, 204), 1));
-
- containerEditor.GraphicProperties.FillColor = linearGradient;
- containerEditor.DrawRectangle(new Rect(10, 10, 48, 29));
- {{endregion}}
+
- The gradient created in __Example 2__ is shown in __Figure 1__.
+The gradient created in __Example 2__ is shown in __Figure 1__.
- #### Figure 1: LinearGradient
- 
+#### Figure 1: LinearGradient
+
+
* __RadialGradient__: Defines a blend between two circles, optionally extended beyond the boundary circles by continuing the boundary colors. The __RadialGradient__ class exposes the following properties:
@@ -124,16 +99,7 @@ The __Gradient__ class is inherited by the following classes:
#### __[C#] Example 3: Create RadialGradient__
- {{region cs-radpdfprocessing-concepts-colors-and-color-spaces_3}}
- FixedContentEditor containerEditor = new FixedContentEditor(container);
-
- RadialGradient radialGradient = new RadialGradient(new Point(40, 40), new Point(40, 40), 0, 30);
- radialGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 207, 0), 0));
- radialGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 102, 204), 1));
-
- containerEditor.GraphicProperties.FillColor = radialGradient;
- containerEditor.DrawEllipse(new Point(40, 40), 30, 30);
- {{endregion}}
+
The result from __Example 3__ is shown in __Figure 2__.
@@ -177,18 +143,7 @@ Since the __TilingBase__ class implements the __IContentRootElement__ interface
#### __[C#] Example 4: Create tiling__
-{{region cs-radpdfprocessing-concepts-colors-and-color-spaces_2}}
- FixedContentEditor containerEditor = new FixedContentEditor(container);
-
- Tiling tiling = new Tiling(new Rect(0, 0, 10, 10));
- FixedContentEditor tilingEditor = new FixedContentEditor(tiling);
- tilingEditor.GraphicProperties.IsStroked = false;
- tilingEditor.GraphicProperties.FillColor = new RgbColor(128, 28, 43);
- tilingEditor.DrawRectangle(new Rect(2, 2, 5, 7));
-
- containerEditor.GraphicProperties.FillColor = tiling;
- containerEditor.DrawCircle(new Point(30, 30), 20);
-{{endregion}}
+
The tiling created in __Example 4__ is shown in __Figure 3__.
@@ -201,13 +156,7 @@ The tiling created in __Example 4__ is shown in __Figure 3__.
#### Create LabColor
-```csharp
- double[] whitePoint = new double[3] { 1, 2, 3 };
- double[] range = new double[4] { 4, 5, 6, 7 };
- double[] expectedBlackPoint = new double[3] { 0, 0, 0 };
-
- LabColor labColor = new LabColor(1, 2, 3, whitePoint, range);
-```
+
## See Also
diff --git a/libraries/radpdfprocessing/concepts/fonts.md b/libraries/radpdfprocessing/concepts/fonts.md
index 105bbaa2..ceedfcc4 100644
--- a/libraries/radpdfprocessing/concepts/fonts.md
+++ b/libraries/radpdfprocessing/concepts/fonts.md
@@ -80,11 +80,8 @@ There are 14 *Type 1* fonts, known as the standard 14 fonts, that are not embedd
| ZapfDingbats|
-{{region cs-radpdfprocessing-concepts-fonts_0}}
- FontBase helvetica = FontsRepository.Helvetica;
-
-{{endregion}}
+
>tip These fonts, or their font metrics and suitable substitution fonts, must be available to the consumer application.
@@ -93,11 +90,7 @@ FontsRepository will replace the provided standard font with the passed font dat
#### Replace a Standard Font
-```csharp
- byte[] fontData = File.ReadAllBytes("Courier-font.ttf");
- FontsRepository.ReplaceStandardFont(StandardFontNames.Courier, fontData);
-
-```
+
## Embedded Fonts
@@ -113,49 +106,23 @@ __Example 1__ demonstrates how you can use the RegisterFont() method.
#### __[C#] Example 1: Register font in .NET Framework application__
-{{region cs-radpdfprocessing-concepts-fonts_1}}
-
- // Read the font file
- byte[] fontData = File.ReadAllBytes("some-font.ttf");
- System.Windows.Media.FontFamily fontFamily = new System.Windows.Media.FontFamily("Some Font");
-
- // Register the font
- Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.RegisterFont(fontFamily, System.Windows.FontStyles.Normal, System.Windows.FontWeights.Normal, fontData);
-{{endregion}}
+
#### __[C#] Example 1: Register font in .NET Standard application__
-{{region cs-radpdfprocessing-concepts-fonts_2}}
-
- // Read the font file
- byte[] fontData = File.ReadAllBytes("some-font.ttf");
- Telerik.Documents.Core.Fonts.FontFamily fontFamily = new Telerik.Documents.Core.Fonts.FontFamily("Some Font");
-
- // Register the font
- Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.RegisterFont(fontFamily, Telerik.Documents.Core.Fonts.FontStyles.Normal, Telerik.Documents.Core.Fonts.FontWeights.Normal, fontData);
-{{endregion}}
+
### Creating a Font
>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.
-{{region cs-radpdfprocessing-concepts-fonts_3}}
-
- FontBase courier = FontsRepository.Courier;
- TextFragment textFragment = new TextFragment();
- textFragment.Font = courier;
-
-{{endregion}}
+
__Example 2__ shows how to create a font using the FontsRepository.
-
#### __[C#] Example 2: Create FontBase__
-{{region cs-radpdfprocessing-concepts-fonts_4}}
- FontBase font;
- bool success = FontsRepository.TryCreateFont(fontFamily, fontStyle, fontWeight, out font);
-{{endregion}}
+
You can create fonts that are not explicitly registered. Creating a font that is not registered in the repository with the code from __Example 2__ tries to find the font from the ones installed on the machine.
diff --git a/libraries/radpdfprocessing/concepts/geometry.md b/libraries/radpdfprocessing/concepts/geometry.md
index 74252b29..ff408ba4 100644
--- a/libraries/radpdfprocessing/concepts/geometry.md
+++ b/libraries/radpdfprocessing/concepts/geometry.md
@@ -47,10 +47,7 @@ __Example 1__ shows how to create a RectangleGeometry.
#### __[C#] Example 1: Create RectangleGeometry__
-{{region cs-radpdfprocessing-concepts-geometry_0}}
- RectangleGeometry rectangleGeometry = new RectangleGeometry();
- rectangleGeometry.Rect = new Rect(10, 5, 400, 300);
-{{endregion}}
+
@@ -72,18 +69,7 @@ __Example 2__ shows how to create a PathGeometry, which consists of line segment
#### __[C#] Example 2: Create PathGeometry__
-{{region cs-radpdfprocessing-concepts-geometry_1}}
- PathGeometry pathGeometry = new PathGeometry();
- PathFigure pathFigure = pathGeometry.Figures.AddPathFigure();
- pathFigure.StartPoint = new Point(5, 5);
- LineSegment lineSegment = pathFigure.Segments.AddLineSegment();
- lineSegment.Point = new Point(205, 5);
- BezierSegment bezierSegment = pathFigure.Segments.AddBezierSegment();
- bezierSegment.Point1 = new Point(105, 50);
- bezierSegment.Point2 = new Point(130, 105);
- bezierSegment.Point3 = new Point(100, 200);
- pathFigure.IsClosed = true;
-{{endregion}}
+
diff --git a/libraries/radpdfprocessing/concepts/imagequality.md b/libraries/radpdfprocessing/concepts/imagequality.md
index 2774380f..b1db5ad3 100644
--- a/libraries/radpdfprocessing/concepts/imagequality.md
+++ b/libraries/radpdfprocessing/concepts/imagequality.md
@@ -33,10 +33,7 @@ In order to specify the default **ImageQuality** value when exporting to PDF, yo
#### __[C#] Example 1: Set a default value for all images in a document__
-{{region cs-radpdfprocessing-concepts-imagequality_0}}
- PdfExportSettings settings = new PdfExportSettings();
- settings.ImageQuality = ImageQuality.Medium;
-{{endregion}}
+
> `PdfExportSettings.ImageQuality` property doesn't affect the quality of the images imported from a PDF document. Such images are preserved using `EncodedImageData` (see [ImageQuality and EncodedImageData Class](#imagequality-and-encodedimagedata-class)). `PdfExportSettings.ImageQuality` only affects the export quality of images created using an image stream or a `BitmapSource`.
@@ -46,9 +43,7 @@ If you need some particular image to be exported with a different **ImageQuality
#### __[C#] Example 2: Set the image quality of an image__
-{{region cs-radpdfprocessing-concepts-imagequality_1}}
- ImageSource imageSource = new ImageSource(bitmap, ImageQuality.Medium);
-{{endregion}}
+
### ImageQuality and EncodedImageData Class
diff --git a/libraries/radpdfprocessing/concepts/position.md b/libraries/radpdfprocessing/concepts/position.md
index 8dc1fd1c..2c18c4ba 100644
--- a/libraries/radpdfprocessing/concepts/position.md
+++ b/libraries/radpdfprocessing/concepts/position.md
@@ -62,11 +62,7 @@ __Example 1__ shows how transformations can be appended.
#### __[C#] Example 1: Trasform MatrixPosition__
-{{region cs-radpdfprocessing-concepts-position_0}}
- MatrixPosition matrixPosition = new MatrixPosition();
- matrixPosition.Translate(20, 20); // Translates the position by (20, 20)
- matrixPosition.Translate(30, 30); // Translates the position by (30, 30).
-{{endregion}}
+
@@ -91,11 +87,7 @@ __Example 2__ shows how transformations overwrite the previous transformations o
#### __[C#] Example 2: Transform SimplePosition__
-{{region cs-radpdfprocessing-concepts-position_1}}
- SimplePosition simplePosition = new SimplePosition();
- simplePosition.Translate(20, 20); // Translates the position by (20, 20).
- simplePosition.Translate(30, 30); // Translates the position by (30, 30) overwriting the previous translations.
-{{endregion}}
+
diff --git a/libraries/radpdfprocessing/cross-platform/images.md b/libraries/radpdfprocessing/cross-platform/images.md
index 8f0f9c81..65425c53 100644
--- a/libraries/radpdfprocessing/cross-platform/images.md
+++ b/libraries/radpdfprocessing/cross-platform/images.md
@@ -43,11 +43,8 @@ PdfProcessing comes with a default implementation for such resolver called `Imag
>note View Implementation [Requirements](#requirements).
#### **[C#] Example 1: Set the default implementation of the ImagePropertiesResolver class**
- {{region cs-radpdfprocessing-cross-platform-images_0}}
-
- Telerik.Documents.ImageUtils.ImagePropertiesResolver defaultImagePropertiesResolver = new Telerik.Documents.ImageUtils.ImagePropertiesResolver();
- Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.ImagePropertiesResolver = defaultImagePropertiesResolver;
- {{endregion}}
+
+
### Custom Implementation for ImagePropertiesResolver
@@ -72,49 +69,20 @@ The **Telerik.Documents.ImageUtils** assembly provides a default implementation
>note View Implementation [Requirements](#requirements).
#### **[C#] Example 2: Set the default implementation of the JpegImageConverter class**
- {{region cs-radpdfprocessing-cross-platform_3}}
- Telerik.Windows.Documents.Extensibility.JpegImageConverterBase defaultJpegImageConverter = new Telerik.Documents.ImageUtils.JpegImageConverter();
- Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.JpegImageConverter = defaultJpegImageConverter;
- {{endregion}}
+
### Custom Implementation for JpegImageConverter
The following example depends on the [Magick.NET](https://www.nuget.org/packages/Magick.NET-Q16-AnyCPU/) library to convert images to Jpeg format.
#### **[C#] Example 3: Create a custom implementation inheriting the JpegImageConverterBase abstract class**
- {{region cs-radpdfprocessing-cross-platform_2}}
-
- internal class CustomJpegImageConverter : Telerik.Windows.Documents.Extensibility.JpegImageConverterBase
- {
- public override bool TryConvertToJpegImageData(byte[] imageData, ImageQuality imageQuality, out byte[] jpegImageData)
- {
- IMagickFormatInfo? formatInfo = MagickFormatInfo.Create(imageData);
- if (formatInfo != null && formatInfo.SupportsReading)
- {
- using (MagickImage magickImage = new MagickImage(imageData))
- {
- magickImage.Alpha(AlphaOption.Remove);
- magickImage.Quality = (int)imageQuality;
-
- jpegImageData = magickImage.ToByteArray(MagickFormat.Jpeg);
- }
-
- return true;
- }
-
- jpegImageData = null;
- return false;
- }
- }
- {{endregion}}
+
+
#### **[C#] Example 4: Set the custom implementation to the JpegImageConverter property of the FixedExtensibilityManager**
- {{region cs-radpdfprocessing-cross-platform_3}}
-
- JpegImageConverterBase customJpegImageConverter = new CustomJpegImageConverter();
- Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.JpegImageConverter = customJpegImageConverter;
- {{endregion}}
+
+
>note A complete SDK example of a custom implementation JpegImageConverterBase is available on our [GitHub repository](https://github.com/telerik/document-processing-sdk/tree/master/PdfProcessing/CustomJpegImageConverter).
diff --git a/libraries/radpdfprocessing/editing/block.md b/libraries/radpdfprocessing/editing/block.md
index 0133f92e..7e6e1b9a 100644
--- a/libraries/radpdfprocessing/editing/block.md
+++ b/libraries/radpdfprocessing/editing/block.md
@@ -25,18 +25,7 @@ Inserting [TextFragments]({%slug radpdfprocessing-model-textfragment%}) is achie
#### __[C#] Example 1: Insert text__
-{{region cs-radpdfprocessing-editing-block_0}}
- Block block = new Block();
- block.InsertText("Text");
-
- // .NET Framework
- block.InsertText(new System.Windows.Media.FontFamily("Arial"), "Text");
- block.InsertText(new System.Windows.Media.FontFamily("Arial"), System.Windows.FontStyles.Italic, System.Windows.FontWeights.Bold, "Text");
-
- // .NET Standard
- //block.InsertText(new Telerik.Documents.Core.Fonts.FontFamily("Arial"), "Text");
- //block.InsertText(new Telerik.Documents.Core.Fonts.FontFamily("Arial"), Telerik.Documents.Core.Fonts.FontStyles.Italic, Telerik.Documents.Core.Fonts.FontWeights.Bold, "Text");
-{{endregion}}
+
>The '\r' and '\n' characters don't have the usual meaning of "go to next line" when they are inserted into a PDF document and you cannot simply insert text containing these characters to produce multiline text. Instead, you should insert a line break.
@@ -49,9 +38,7 @@ Inserting a line break results in the next element starting on a new line. The a
#### __[C#] Example 2: Break the line__
-{{region cs-radpdfprocessing-editing-block_1}}
- block.InsertLineBreak();
-{{endregion}}
+
### Inserting Image
@@ -66,13 +53,7 @@ __Block__ provides the following methods for inserting images:
#### __[C#] Example 3: Inserting an image__
-{{region cs-radpdfprocessing-editing-block_2}}
- string imageFilePath = "sample.jpg";
- FileStream fileStream = new FileStream(imageFilePath, FileMode.Open);
- Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource imageSrc = new Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(fileStream);
-
- block.InsertImage(imageSrc, 300, 200);
-{{endregion}}
+
Information on images in the context of the library is available in the [ImageSource]({%slug radpdfprocessing-model-imagesource%}) and [Image]({%slug radpdfprocessing-model-image%}) articles.
@@ -89,17 +70,7 @@ Information on images in the context of the library is available in the [ImageSo
#### __[C#] Example 4: Inserting a geometry__
-{{region cs-radpdfprocessing-editing-block_3}}
- Telerik.Windows.Documents.Fixed.Model.Graphics.RectangleGeometry rectangleGeometry = new Telerik.Windows.Documents.Fixed.Model.Graphics.RectangleGeometry();
- // .NET Framework
- rectangleGeometry.Rect = new System.Windows.Rect(10, 10, 400, 300);
- block.InsertRectangle(new System.Windows.Rect(10, 10, 200, 150));
- // .NET Standard
- //rectangleGeometry.Rect = new Telerik.Documents.Primitives.Rect(10, 5, 400, 300);
- //block.InsertRectangle(new Telerik.Documents.Primitives.Rect(20, 30, 200, 150));
-
- block.InsertPath(rectangleGeometry);
-{{endregion}}
+
### Inserting Form-XObject Elements
@@ -107,16 +78,7 @@ The Form (or also known as Form-XObject) is an object that can contain PDF conte
#### __[C#] Example 5: Insert a form__
-{{region cs-radpdfprocessing-editing-block_4}}
- FormSource simpleForm = new FormSource();
- simpleForm.Size = new System.Windows.Size(310, 250); // .NET Framework
- //simpleForm.Size = new Telerik.Documents.Primitives.Size(310, 250); // .NET Standard
-
- FixedContentEditor formEditor = new FixedContentEditor(simpleForm);
- formEditor.DrawText("Sample text.");
-
- block.InsertForm(simpleForm);
-{{endregion}}
+
There are two more overloads of InsertForm() that enables you to pass the size that should be used for the form.
@@ -129,13 +91,7 @@ The following example shows how to insert a link inside the text:
#### __[C#] Example: Insert a text link__
-{{region cs-radpdfprocessing-editing-block_text-link}}
-
- Block block = new Block();
- block.InsertHyperlinkStart(new Uri("https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/getting-started"));
- block.InsertText(text4);
- block.InsertHyperlinkEnd();
-{{endregion}}
+
### Changing Current Styles
@@ -206,33 +162,7 @@ The __Block__ class has some properties and methods that affect how it will be r
#### __[C#] Example 6: Change Block properties__
-{{region cs-radpdfprocessing-editing-block_5}}
- RadFixedDocument radFixedDocument = new RadFixedDocument();
- RadFixedPage page = radFixedDocument.Pages.AddPage();
-
- Block block = new Block();
- block.GraphicProperties.FillColor = new RgbColor(100, 0, 0, 0);
- block.SpacingBefore = 10;
- block.SpacingAfter = 5;
- block.LineSpacingType = HeightType.Exact;
- block.LineSpacing = 15;
- block.FirstLineIndent = 0;
- block.LeftIndent = 0;
- block.RightIndent = 0;
- block.BackgroundColor = new RgbColor(100, 255, 0, 0);
- block.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Left;
- block.VerticalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.VerticalAlignment.Top;
- block.InsertText("block content");
-
- TextFragment bulletTextFragment = new TextFragment();
- bulletTextFragment.Text = "•";
- block.Bullet = bulletTextFragment;
- block.IndentAfterBullet = 15;
-
- var editor = new FixedContentEditor(page);
- editor.Position.Translate(50,50);
- editor.DrawBlock(block);
-{{endregion}}
+

@@ -242,12 +172,7 @@ A Block can be drawn to the content using the __Draw()__ method. The method acce
#### __[C#] Example 7: Draw block__
-{{region cs-radpdfprocessing-editing-block_6}}
- Rect boundingRect = new Rect(new Point(0, 0), new Size(200, 300));
- block.Draw(fixedContentEditor, boundingRect);
-{{endregion}}
-
-
+
>importantEvery block can be drawn only once. Otherwise, an exception will be thrown.
@@ -284,21 +209,7 @@ The code in __Example 9__ splits a block in two. The first will contains text "H
#### __[C#] Example 9: Split block__
-{{region cs-radpdfprocessing-editing-block_8}}
- Block helloBlock = new Block();
- helloBlock.InsertText("Hello");
- Size helloSize = helloBlock.Measure();
-
- Block block = new Block();
- block.InsertText("Hello RadPdfProcessing!");
-
- CancellationTokenSource cancellationTokenSource = new(TimeSpan.FromSeconds(10));
- CancellationToken cancellationToken = cancellationTokenSource.Token;
-
- Size size = block.Measure(helloSize, cancellationToken);
-
- Block secondBlock = block.Split();
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/editing/fixedcontenteditor.md b/libraries/radpdfprocessing/editing/fixedcontenteditor.md
index 4755ef1e..9e739980 100644
--- a/libraries/radpdfprocessing/editing/fixedcontenteditor.md
+++ b/libraries/radpdfprocessing/editing/fixedcontenteditor.md
@@ -64,9 +64,7 @@ Inserting a [TextFragment]({%slug radpdfprocessing-model-textfragment%}) can be
#### __[C#] Example 3: Insert TextFragment__
-{{region cs-radpdfprocessing-editing-fixedcontenteditor_2}}
- fixedContentEditor.DrawText("First text fragment.");
-{{endregion}}
+
__Figure 1__ shows the result of __Example 3__.
@@ -82,12 +80,7 @@ __Example 4__ shows how you can use the __Block__ object to draw a paragraph.
#### __[C#] Example 4: Insert paragraph__
-{{region cs-radpdfprocessing-editing-fixedcontenteditor_3}}
- Block block = new Block();
- block.InsertText("First sentence.");
- block.InsertText("Second sentence.");
- fixedContentEditor.DrawBlock(block);
-{{endregion}}
+
__Figure 2__ shows the result of __Example 4__.
@@ -112,12 +105,7 @@ __Example 5__ shows how you can add an image created from a Stream.
#### __[C#] Example 5: Insert image__
-{{region cs-radpdfprocessing-editing-fixedcontenteditor_4}}
- using (Stream stream = this.GetResourceStream("Telerik_logo.jpg"))
- {
- fixedContentEditor.DrawImage(stream, new Size(118, 28));
- }
-{{endregion}}
+
#### Figure 3: Image result

@@ -136,9 +124,7 @@ __Example 6__ shows how you can add an ellipse using one of FixedContentEditor's
#### __[C#] Example 6: Insert ellipse__
-{{region cs-radpdfprocessing-editing-fixedcontenteditor_5}}
- fixedContentEditor.DrawEllipse(new Point(250, 70), 136, 48);
-{{endregion}}
+
### Inserting Clipping
@@ -169,26 +155,7 @@ __Example 8__ generates a table and draws it in some fixed size.
#### __[C#] Example 8: Insert table__
-{{region cs-radpdfprocessing-editing-fixedcontenteditor_8}}
- Table table = new Table();
- Border border = new Border();
- table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border);
- table.DefaultCellProperties.Padding = new Thickness(10);
- TableRow firstRow = table.Rows.AddTableRow();
- firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("First cell");
- firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Second cell");
- firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Third cell");
- TableRow secondRow = table.Rows.AddTableRow();
- secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Forth cell");
- secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Fifth cell");
- secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Sixth cell");
-
- RadFixedDocument document = new RadFixedDocument();
- RadFixedPage page = document.Pages.AddPage();
- FixedContentEditor editor = new FixedContentEditor(page);
- fixedContentEditor.Position.Translate(10, 10);
- fixedContentEditor.DrawTable(table, new Size(180, double.PositiveInfinity));
-{{endregion}}
+
#### The table created in Example 8
@@ -201,9 +168,7 @@ More detailed information about tables is available in the [Table]({%slug radpdf
With the FixedContentEditor class you can insert a Form (Form-XObject) element.
#### __[C#] Example 9: Insert a form__
-{{region cs-radpdfprocessing-editing-fixedcontenteditor_9}}
- fixedContentEditor.DrawForm(formSource);
-{{endregion}}
+
There are two more overloads of DrawForm() that enable you to pass the size that should be used for the form.
@@ -217,37 +182,13 @@ The Widget annotations allow you visualize the content of a FormField. With the
#### **[C#] Example 10: Insert PushButtonField with PushButtonWidget using DrawWidget**
- {{region cs-radpdfprocessing-editing-fixedcontenteditor_10}}
-
- PushButtonField pushButton = new PushButtonField("button");
-
- document.AcroForm.FormFields.Add(pushButton);
-
- fixedContentEditor.Position.Translate(20, 450);
- fixedContentEditor.DrawWidget(pushButton, new Size(100, 20));
- {{endregion}}
+
* **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.
#### **[C#] Example 11: Insert RadioButtonField with RadioButtonWidget using DrawWidget**
- {{region cs-radpdfprocessing-editing-fixedcontenteditor_11}}
-
- RadioButtonField radio = new RadioButtonField("radio");
- radio.Options.Add(new RadioOption("first radio"));
- radio.Options.Add(new RadioOption("second radio"));
- radio.Options.Add(new RadioOption("third radio"));
- radio.Value = radio.Options[1];
-
- document.AcroForm.FormFields.Add(radio);
-
- fixedContentEditor.Position.Translate(20, 410);
- fixedContentEditor.DrawWidget(radio, radio.Options[0], new Size(20, 20));
- fixedContentEditor.Position.Translate(50, 410);
- fixedContentEditor.DrawWidget(radio, radio.Options[1], new Size(20, 20));
- fixedContentEditor.Position.Translate(80, 410);
- fixedContentEditor.DrawWidget(radio, radio.Options[2], new Size(20, 20));
- {{endregion}}
+
## Positioning
@@ -257,16 +198,7 @@ The code in __Example 12__ shows how to manipulate the position of the inserted
#### __[C#] Example 12: Scale and rotate content__
-{{region cs-radpdfprocessing-editing-fixedcontenteditor_7}}
- fixedContentEditor.Position.Scale(1.5, 0.5);
- fixedContentEditor.Position.Rotate(10);
- fixedContentEditor.DrawText("Image:");
- fixedContentEditor.Position.Translate(0, 20);
- using (Stream stream = this.GetResourceStream("Telerik_logo.jpg"))
- {
- fixedContentEditor.DrawImage(stream, new Size(118, 28));
- }
-{{endregion}}
+
#### Figure 5: Positioning result
diff --git a/libraries/radpdfprocessing/editing/list.md b/libraries/radpdfprocessing/editing/list.md
index cab74b16..5a951161 100644
--- a/libraries/radpdfprocessing/editing/list.md
+++ b/libraries/radpdfprocessing/editing/list.md
@@ -36,16 +36,7 @@ The code snippet from __Example 1__ shows how to create a list with NumberedPare
#### __[C#] Example 1: Create numbered parentheses list template type__
-{{region cs-radpdfprocessing-editing-list_0}}
- List numberedParenthesesList = new List(ListTemplateType.NumberedParentheses);
-{{endregion}}
-
-#### __[VB.NET] Example 1: Create numbered parentheses list template type__
-
-{{region vb-radpdfprocessing-editing-list_1}}
- Dim numberedParenthesesList = New List(ListTemplateType.NumberedParentheses)
-{{endregion}}
-
+
On the following image you may see the available list template types and how they look:
@@ -76,39 +67,7 @@ __Example 2__ shows how to create an empty list and add two custom list levels t
#### __[C#] Example 2: Create custom list levels__
-{{region cs-radpdfprocessing-editing-list_2}}
- List list = new List();
-
- ListLevel levelZero = list.Levels.AddListLevel();
- levelZero.ParagraphProperties.LeftIndent = 30;
- levelZero.CharacterProperties.ForegroundColor = new RgbColor(100, 100, 100);
- levelZero.IndentAfterBullet = 5;
- levelZero.BulletNumberingFormat = new TextBulletNumberingFormat((indexer) => string.Format("{0:D2}.", indexer.GetCurrentIndex(0)));
-
- ListLevel levelOne = list.Levels.AddListLevel();
- levelOne.ParagraphProperties.LeftIndent = 60;
- levelOne.CharacterProperties.ForegroundColor = new RgbColor(100, 100, 100);
- levelOne.IndentAfterBullet = 10;
- levelOne.BulletNumberingFormat = new TextBulletNumberingFormat((indexer) => "☑");
-{{endregion}}
-
-#### __[VB.NET] Example 2: Create custom list levels__
-
-{{region vb-radpdfprocessing-editing-list_3}}
- Dim list = New List()
-
- Dim levelZero = list.Levels.AddListLevel()
- levelZero.ParagraphProperties.LeftIndent = 30
- levelZero.CharacterProperties.ForegroundColor = New RgbColor(100, 100, 100)
- levelZero.IndentAfterBullet = 5
- levelZero.BulletNumberingFormat = New TextBulletNumberingFormat(Function(indexer) String.Format("{0:D2}.", indexer.GetCurrentIndex(0)))
-
- Dim levelOne = list.Levels.AddListLevel()
- levelOne.ParagraphProperties.LeftIndent = 60
- levelOne.CharacterProperties.ForegroundColor = New RgbColor(100, 100, 100)
- levelOne.IndentAfterBullet = 10
- levelOne.BulletNumberingFormat = New TextBulletNumberingFormat(Function(indexer) "☑")
-{{endregion}}
+
The image in __Figure 3__ shows how the list created in __Example 2__ will look like when used.
@@ -125,52 +84,7 @@ The following code snippet shows how to create the bullets of a numbered hierarc
#### __[C#] Example 3: Create custom text numbering bullet__
-{{region cs-radpdfprocessing-editing-list_4}}
- List list = new List();
-
- for (int i = 0; i < 3; i++)
- {
- ListLevel level = list.Levels.AddListLevel();
- level.ParagraphProperties.LeftIndent = (i + 1) * 20;
- level.IndentAfterBullet = 10;
- int currentLevelIndex = i;
-
- level.BulletNumberingFormat = new TextBulletNumberingFormat((indexer) =>
- {
- StringBuilder builder = new StringBuilder();
-
- for (int levelIndex = 0; levelIndex <= currentLevelIndex; levelIndex++)
- {
- builder.AppendFormat("{0}.", indexer.GetCurrentIndex(levelIndex));
- }
-
- return builder.ToString();
- });
- }
-{{endregion}}
-
-#### __[VB.NET] Example 3: Create custom text numbering bullet__
-
-{{region vb-radpdfprocessing-editing-list_5}}
- Dim list = New List()
- For i = 0 To 2
-
- Dim level = list.Levels.AddListLevel()
- level.ParagraphProperties.LeftIndent = (i + 1) * 20
- level.IndentAfterBullet = 10
- Dim currentLevelIndex As Integer = i
-
- level.BulletNumberingFormat = New TextBulletNumberingFormat(Function(indexer)
-
- Dim builder = New StringBuilder()
- For levelIndex = 0 To currentLevelIndex
- builder.AppendFormat("{0}.", indexer.GetCurrentIndex(levelIndex))
- Next
-
- Return builder.ToString()
- End Function)
- Next
-{{endregion}}
+
When using the list created in __Example 3__ its bullets will look as shown in __Figure 4__.
@@ -186,36 +100,7 @@ __Example 4__ shows how to create a list with __RadFixedDocumentEditor__ and ins
#### __[C#] Example 4: Using lists with RadFixedDocumentEditor__
-{{region cs-radpdfprocessing-editing-list_6}}
- using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document))
- {
- List list = editor.Lists.AddList(ListTemplateType.NumberedDefault);
- editor.ParagraphProperties.ListId = list.Id;
-
- for (int listLevel = 0; listLevel < list.Levels.Count; listLevel++)
- {
- editor.ParagraphProperties.ListLevel = listLevel;
- editor.InsertParagraph();
- editor.InsertRun(string.Format("List level {0}", listLevel));
- }
- }
-{{endregion}}
-
-#### __[VB.NET] Example 4: Using lists with RadFixedDocumentEditor__
-
-{{region vb-radpdfprocessing-editing-list_7}}
- Using editor As New RadFixedDocumentEditor(document)
- Dim list = editor.Lists.AddList(ListTemplateType.NumberedDefault)
- editor.ParagraphProperties.ListId = list.Id
-
- For listLevel = 0 To list.Levels.Count - 1
-
- editor.ParagraphProperties.ListLevel = listLevel
- editor.InsertParagraph()
- editor.InsertRun(String.Format("List level {0}", listLevel))
- Next
- End Using
-{{endregion}}
+
The resulting document looks like the image in **Figure 5**.
@@ -232,23 +117,7 @@ The following code snippet shows how to create __List__ with __BulletDefault__ t
#### __[C#] Example 5: Using lists with Block class__
-{{region cs-radpdfprocessing-editing-list_8}}
- List list = new List(ListTemplateType.BulletDefault);
- Block block = new Block();
- block.SetBullet(list, 0);
- block.InsertText("Sample block text.");
-{{endregion}}
-
-#### __[VB.NET] Example 5: Using lists with Block class__
-
-{{region vb-radpdfprocessing-editing-list_9}}
- Private Sub UsingListsWithBlockClass()
- Dim list = New List(ListTemplateType.BulletDefault)
- Dim block = New Block()
- block.SetBullet(list, 0)
- block.InsertText("Sample block text.")
- End Sub
-{{endregion}}
+
>The list style is applied for the whole Block element. Generating a list consisting of several paragraphs in different list items should be done using the same count of Block instances as the number of the different list items.
diff --git a/libraries/radpdfprocessing/editing/radfixeddocumenteditor.md b/libraries/radpdfprocessing/editing/radfixeddocumenteditor.md
index f7ef4c83..6012ad1b 100644
--- a/libraries/radpdfprocessing/editing/radfixeddocumenteditor.md
+++ b/libraries/radpdfprocessing/editing/radfixeddocumenteditor.md
@@ -34,14 +34,7 @@ __Example 1__ demonstrates how a RadFixedDocumentEditor instance can be created.
#### __[C#] Example 1: Create RadFixedDocumentEditor__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_0}}
- RadFixedDocument radFixedDocument = new RadFixedDocument();
- RadFixedDocumentEditor radFixedDocumentEditor = new RadFixedDocumentEditor(radFixedDocument);
-
- //Use RadFixedDocumentEditor...
-
- radFixedDocumentEditor.Dispose();
-{{endregion}}
+
>__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.
@@ -68,26 +61,17 @@ The section properties are responsible for the page size, margins and orientatio
#### __[C#] Example 2: Setting section properties__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_1}}
- radFixedDocumentEditor.SectionProperties.PageSize = new Size(100,100);
- radFixedDocumentEditor.SectionProperties.PageRotation = Telerik.Windows.Documents.Fixed.Model.Data.Rotation.Rotate90;
-{{endregion}}
+
### Starting New Section
-The first section of a document starts as soon as a content is inserted to the editor. You can change the Section properties before inserting any content and they will be applied to the section that is automatically created.
-
+The first section of a document starts as soon as a content is inserted to the editor. You can change the Section properties before inserting any content and they will be applied to the section that is automatically created.
Adding an additional section is achieved with the __InsertSectionBreak()__ method as demonstrated in __Example 2__.
-
#### __[C#] Example 3: Start a section__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_2}}
- radFixedDocumentEditor.InsertSectionBreak();
-{{endregion}}
-
-
+
>If you want to change the properties of the next section, make sure to do it __before__ you insert the section break. New properties are only used for newly created sections.
@@ -95,9 +79,8 @@ Adding an additional section is achieved with the __InsertSectionBreak()__ metho
All pages that have the same __SectionProperties__ are part of the current section. To start a new page, you can use the following code:
#### __[C#] Example 4: Start new page__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_3}}
- radFixedDocumentEditor.InsertPageBreak();
-{{endregion}}
+
+
## Paragraphs
@@ -133,36 +116,24 @@ Similar to the section properties, paragraph has its own properties that are res
#### __[C#] Example 5: Setting paragraph properties__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_4}}
- radFixedDocumentEditor.ParagraphProperties.SpacingAfter = 10;
- radFixedDocumentEditor.ParagraphProperties.LineSpacingType = HeightType.Auto;
- adFixedDocumentEditor.ParagraphProperties.BackgroundColor = new RgbColor(0, 100, 0);
- radFixedDocumentEditor.ParagraphProperties.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
-{{endregion}}
+
### Starting New Paragraph
-The first paragraph is created as soon as content is inserted in the editor. You can change paragraph properties before inserting content and when the first paragraph is created automatically, it will use the desired properties.
-
+The first paragraph is created as soon as content is inserted in the editor. You can change paragraph properties before inserting content and when the first paragraph is created automatically, it will use the desired properties.
-In order to start a new paragraph, use the code in __Example 4__.
-
+In order to start a new paragraph, use the code in __Example 4__.
#### __[C#] Example 6: Start a paragraph__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_5}}
- radFixedDocumentEditor.InsertParagraph();
-{{endregion}}
+
-
-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.
-
+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.
## Inlines
A Paragraph is built of two types of inlines - runs and images.
-
### Runs
__Run__ represents a collection of characters that have the same properties.
@@ -200,13 +171,7 @@ The character properties that are responsible for the look of the runs are liste
#### __[C#] Example 7: Setting CharacterProperties__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_6}}
- radFixedDocumentEditor.CharacterProperties.FontSize = 12;
- radFixedDocumentEditor.CharacterProperties.Font = FontsRepository.Courier;
- radFixedDocumentEditor.CharacterProperties.HighlightColor = new RgbColor(10, 100, 80);
- radFixedDocumentEditor.CharacterProperties.BaselineAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.BaselineAlignment.Subscript;
- radFixedDocumentEditor.CharacterProperties.UnderlinePattern = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.UnderlinePattern.Single;
-{{endregion}}
+
>In order for the character properties to be respected, make sure to set them __before__ inserting the Run.
@@ -214,17 +179,11 @@ The character properties that are responsible for the look of the runs are liste
### Inserting a Run
-There are a number of overloads that insert a run. The code snippet in __Example 5__ inserts new runs with specific font family, style and weight.
-
+There are a number of overloads that insert a run. The code snippet in __Example 5__ inserts new runs with specific font family, style and weight.
#### __[C#] Example 8: Insert run__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_7}}
- radFixedDocumentEditor.InsertRun("text");
- radFixedDocumentEditor.InsertRun(new FontFamily("Helvetica"),"text");
-{{endregion}}
-
-
+
There are a number of overloads that insert a run. The code snippet in __Example 5__ inserts a couple of new runs, one of which with a specific font family.
@@ -235,27 +194,19 @@ The code in __Example 9__ inserts a new run and a line break after it.
#### __[C#] Example 9: Insert run and line break__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_8}}
- radFixedDocumentEditor.InsertLine("Line of text");
-{{endregion}}
-
+
### Images
Image inline is a combination of an [ImageSource]({%slug radpdfprocessing-model-imagesource%}) object and its desired size.
-
### Inserting Image
You can insert image inline using one of the following methods:
#### __[C#] Example 10: Insert image__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_9}}
- ImageSource imageSource = new ImageSource(new FileStream("image.jpeg", FileMode.Open));
- radFixedDocumentEditor.InsertImageInline(imageSource);
- radFixedDocumentEditor.InsertImageInline(imageSource, new Size(100, 100));
-{{endregion}}
+
## Tables
@@ -264,13 +215,7 @@ The __Table__ class implements the __IBlockElement__ interface and an instance o
#### __[C#] Example 11: Insert table__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_10}}
- Table table = new Table();
- TableRow firstRow = table.Rows.AddTableRow();
- firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cellText");
-
- radFixedDocumentEditor.InsertTable(table);
-{{endregion}}
+
For more detailed information on tables, check the [Table]({%slug radpdfprocessing-editing-table-overview%}) documentation article.
@@ -280,13 +225,7 @@ The [IBlockElement](https://docs.telerik.com/devtools/document-processing/api/Te
#### __[C#] Example 12: Insert Block element__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_11}}
- Block block = new Block();
- block.InsertText("Text");
-
- radFixedDocumentEditor.InsertBlock(block);
-{{endregion}}
-
+
## Lists
@@ -295,12 +234,8 @@ You can easily insert list items with __RadFixedDocumentEditor__. The first thin
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:
#### __[C#] Example 13: Insert list__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_12}}
- List list = radFixedDocumentEditor.Lists.AddList(ListTemplateType.NumberedDefault);
- radFixedDocumentEditor.ParagraphProperties.ListId = list.Id;
- radFixedDocumentEditor.ParagraphProperties.ListLevel = 0;
- radFixedDocumentEditor.InsertParagraph();
-{{endregion}}
+
+
More detailed information about lists is available in the [List documentation article]({%slug radpdfprocessing-editing-list%}).
@@ -309,9 +244,7 @@ More detailed information about lists is available in the [List documentation ar
With the RadFixedDocumentEditor class you can insert a Form (Form-XObject) element.
#### __[C#] Example 14: Insert a form__
-{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_13}}
- radFixedDocumentEditor.InsertFormInline(formSource);
-{{endregion}}
+
There is an additional overload of InsertFormInline() that enables you to pass the size that should be used for the form.
diff --git a/libraries/radpdfprocessing/editing/text-and-graphic-properties.md b/libraries/radpdfprocessing/editing/text-and-graphic-properties.md
index e051e3d3..311e7e1e 100644
--- a/libraries/radpdfprocessing/editing/text-and-graphic-properties.md
+++ b/libraries/radpdfprocessing/editing/text-and-graphic-properties.md
@@ -39,17 +39,7 @@ These properties are used to hold the current graphics control parameters. The f
#### [C#] Example 1: Using GraphicProperties with FixedContentEditor
-{{region radpdfprocessing-editing-text-and-graphic-properties_0}}
-
- editor.GraphicProperties.IsFilled = true;
- editor.GraphicProperties.IsStroked = true;
-
- editor.GraphicProperties.FillColor = new RgbColor(255, 0, 0);
- editor.GraphicProperties.StrokeColor = RgbColors.Black;
- editor.GraphicProperties.StrokeThickness = 2;
- editor.GraphicProperties.StrokeDashArray = new double[] { 2, 2, 5 };
- editor.GraphicProperties.StrokeLineJoin = Telerik.Windows.Documents.Fixed.Model.Graphics.LineJoin.Round;
-{{endregion}}
+
## TextProperties
@@ -91,17 +81,7 @@ These properties hold the parameters used for text fragments. The following para
#### [C#] Example 2: Using TextProperties with Block
-{{region radpdfprocessing-editing-text-and-graphic-properties_1}}
-
- block.TextProperties.CharacterSpacing = 5;
- block.TextProperties.Font = FontsRepository.TimesBold;
- block.TextProperties.FontSize = Unit.PointToDip(12);
-
- block.TextProperties.HighlightColor = new RgbColor(40, 60, 80);
- block.TextProperties.RenderingMode = Telerik.Windows.Documents.Fixed.Model.Text.RenderingMode.FillAndStroke;
- block.TextProperties.UnderlinePattern = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.UnderlinePattern.Single;
- block.TextProperties.UnderlineColor = RgbColors.Black;;
-{{endregion}}
+
The TextProperties also exposes the following methods, which can be used for changing the current font:
diff --git a/libraries/radpdfprocessing/features/bookmarks.md b/libraries/radpdfprocessing/features/bookmarks.md
index 879f59ce..c3a91892 100644
--- a/libraries/radpdfprocessing/features/bookmarks.md
+++ b/libraries/radpdfprocessing/features/bookmarks.md
@@ -40,19 +40,8 @@ The **BookmarkItem** class exposes several constructor overloads which enable yo
* BookmarkItem(string title, NamedDestination namedDestination)
-#### **[C#] Example 1: Creating a bookmark and setting its properties**
-{{region radpdfprocessing-features-bookmarks_0}}
-
- Location location = new Location();
- location.Page = document.Pages[0];
- location.Left = 10;
- location.Top = 10;
- BookmarkItem bookmark = new BookmarkItem("Title", location);
- bookmark.TextColor = new RgbColor(255, 0, 255);
- bookmark.TextStyle = BookmarkItemStyles.Bold | BookmarkItemStyles.Italic;
- bookmark.IsExpanded = true;
-{{endregion}}
+
## Bookmarks Collection
@@ -60,42 +49,15 @@ The **Bookmarks** property exposed through the **RadFixedDocument** class allows
Inserting a bookmark in a document is achieved by adding it to the Bookmarks collection. **Example 2** shows adding the **BookmarkItem** created in [**Example 1**](#example-1)
-#### **[C#] Example 2: Adding a bookmark to a document**
-{{region radpdfprocessing-features-bookmarks_1}}
-
- document.Bookmarks.Add(bookmark);
-{{endregion}}
+
Removing a bookmark is pretty similar to adding one. In **Example 3**, the second bookmark inside the document is removed.
-#### **[C#] Example 3: Removing a bookmark from a document**
-{{region radpdfprocessing-features-bookmarks_2}}
-
- BookmarkItem bookmark = document.Bookmarks[1];
- document.Bookmarks.RemoveAt(1);
-{{endregion}}
+
In case you need to iterate all the bookmarks in a document, keep in mind that each BookmarkItem can contain other bookmarks in its Children collection. If you are encountering such a case, you will need to iterate the Bookmarks collection recursively.
-#### **[C#] Example 4: Iterate through all bookmarks**
-{{region radpdfprocessing-features-bookmarks_3}}
-
- private static void IterateBookmarks(RadFixedDocument document)
- {
- foreach (BookmarkItem bookmark in document.Bookmarks)
- {
- IterateBookmarksHierarchy(bookmark);
- }
- }
-
- private static void IterateBookmarksHierarchy(BookmarkItem bookmark)
- {
- foreach (BookmarkItem child in bookmark.Children)
- {
- IterateBookmarksHierarchy(child);
- }
- }
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/features/digital-signature/getting-started.md b/libraries/radpdfprocessing/features/digital-signature/getting-started.md
index 1b441aac..97bf322e 100644
--- a/libraries/radpdfprocessing/features/digital-signature/getting-started.md
+++ b/libraries/radpdfprocessing/features/digital-signature/getting-started.md
@@ -31,68 +31,7 @@ The following example shows a full code snippet for a simple signing of a newly
#### **[C#] Example: Sign a document**
-{{region radpdfprocessing-features-digital-signature_2}}
-
- using System;
- using Telerik.Windows.Documents.Fixed.Model.Annotations;
- using System.Security.Cryptography.X509Certificates;
- using Telerik.Windows.Documents.Fixed.Model.Editing;
- using Telerik.Windows.Documents.Fixed.Model.InteractiveForms;
- using Telerik.Windows.Documents.Fixed.Model.Objects;
- using Telerik.Windows.Documents.Fixed.Model.Resources;
- using Telerik.Windows.Documents.Fixed.Model;
- using Telerik.Windows.Documents.Fixed.Model.DigitalSignatures;
- using System.Windows;
- using System.IO;
-
- namespace ConsoleNetFramework
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int signatureFieldWidth = 200;
- int signatureFieldHeight = 50;
- int signaturePositionLeft = 10;
- int signaturePositionTop = 10;
-
- X509Certificate2 certificate = new System.Security.Cryptography.X509Certificates.X509Certificate2("Certificate.pfx", "johndoe");
- SignatureField pdfSignature = new SignatureField("SignatureField");
- pdfSignature.Signature = new Signature(certificate);
-
- Form pdfForm = new Telerik.Windows.Documents.Fixed.Model.Objects.Form();
- pdfForm.FormSource = new FormSource();
- pdfForm.FormSource.Size = new Size(signatureFieldWidth, signatureFieldHeight);
- FixedContentEditor editor = new FixedContentEditor(pdfForm.FormSource);
- pdfForm.Position.Translate(signaturePositionLeft, signaturePositionTop);
- editor.DrawText($"{certificate.GetNameInfo(X509NameType.SimpleName, false)} {DateTime.Now.ToString("yyyy.MM.dd HH:mm")}");
-
- SignatureWidget signatureWidget = pdfSignature.Widgets.AddWidget();
- signatureWidget.Content.NormalContentSource = pdfForm.FormSource;
- signatureWidget.Rect = new Rect(signaturePositionLeft,signaturePositionTop,signatureFieldWidth,signatureFieldHeight);
- signatureWidget.RecalculateContent();
-
- RadFixedDocument document = new RadFixedDocument();
- RadFixedPage pdfPage = document.Pages.AddPage();
- pdfPage.Annotations.Add(signatureWidget);
-
- FixedContentEditor pageEditor = new FixedContentEditor(pdfPage);
- pageEditor.Position.Translate(signaturePositionLeft, signaturePositionTop);
- pageEditor.DrawForm(pdfForm.FormSource);
- document.AcroForm.FormFields.Add(pdfSignature);
- signatureWidget.RecalculateContent();
-
- string signedDocumentFilePath = "signed.pdf";
- File.Delete(signedDocumentFilePath);
- using (System.IO.Stream output = new System.IO.FileStream(signedDocumentFilePath, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite))
- {
- new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider().Export(document, output);
- }
- }
- }
- }
-
-{{endregion}}
+
>important In .NET Standard use __Telerik.Documents.Primitives.Rect__ instead of __System.Windows.Rect__.
@@ -116,11 +55,7 @@ The signature flags were introduced in R2022 SP1. You can set the flags with the
#### **[C#] Example: Set signature flags**
-{{region radpdfprocessing-features-digital-signature_5}}
-
- pdfDocument.AcroForm.SignatureFlags = SignatureFlags.None;
-
-{{endregion}}
+
The possible values are:
* __None__: Indicates no signature fields exist.
diff --git a/libraries/radpdfprocessing/features/digital-signature/signature-validation.md b/libraries/radpdfprocessing/features/digital-signature/signature-validation.md
index e8044250..85196053 100644
--- a/libraries/radpdfprocessing/features/digital-signature/signature-validation.md
+++ b/libraries/radpdfprocessing/features/digital-signature/signature-validation.md
@@ -31,49 +31,7 @@ The following example shows how the validation can be used:
#### **[C#] Example: Validate a field**
-{{region radpdfprocessing-features-digital-signature_3}}
-
- RadFixedDocument document = new PdfFormatProvider().Import(stream, TimeSpan.FromSeconds(10)); // The stream containing the document
-
- string validationStatus;
-
- // For simplicity, the example handles only the first signature.
- SignatureField firstSignatureField = document.AcroForm.FormFields.FirstOrDefault(field => field.FieldType == FormFieldType.Signature) as SignatureField;
- if (firstSignatureField != null && firstSignatureField.Signature != null)
- {
- SignatureValidationProperties properties = new SignatureValidationProperties();
- System.Security.Cryptography.X509Certificates.X509VerificationFlags verificationFlags = System.Security.Cryptography.X509Certificates.X509VerificationFlags.IgnoreInvalidName;
- properties.Chain.ChainPolicy.VerificationFlags = verificationFlags;
-
- SignatureValidationResult validationResult;
- if (firstSignatureField.Signature.TryValidate(properties, out validationResult))
- {
- if (!validationResult.IsDocumentModified)
- {
- if (validationResult.IsCertificateValid)
- {
- validationStatus = "Valid";
- }
- else
- {
- validationStatus = "Unknown";
- }
- }
- else
- {
- validationStatus = "Invalid";
- }
- }
- else
- {
- validationStatus = "Invalid";
- }
- }
- else
- {
- validationStatus = "None";
- }
-{{endregion}}
+
>To evaluate a certificate as trusted, it must be added to the [trusted certificates on your machine](https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-view-certificates-with-the-mmc-snap-in).
diff --git a/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md b/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md
index 6b3dd08d..2609e786 100644
--- a/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md
+++ b/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md
@@ -22,17 +22,7 @@ RadFixedDocument stores the integrated files in an **EmbeddedFilesCollection** a
#### **[C#] Creating an embedded file stream**
-{{region cs-radpdfprocessing-embedded-file-streams_creating_1}}
-
- RadFixedDocument document = new RadFixedDocument();
- RadFixedPage page = document.Pages.AddPage();
- byte[] textFile = File.ReadAllBytes(@"..\..\Embedded_File_Streams.txt");
- document.EmbeddedFiles.Add("Text file.txt", textFile);
- byte[] imageFile = File.ReadAllBytes(@"..\..\Basel.JPG");
- document.EmbeddedFiles.Add("Basel photo.jpg", imageFile);
-
-
-{{endregion}}
+
>important **DuplicatedEmbeddedFileNameException** is thrown when adding an embedded file with a name that is already added to the collection.
@@ -45,27 +35,7 @@ RadPdfProcessing provides support for embedding of [ZUGFeRD](https://de.wikipedi
#### **[C#] Add ZUGFeRD invoice**
-{{region cs-radpdfprocessing-embedded-file-add-zugferd-invoice}}
-
- RadFixedDocument document = new RadFixedDocument();
- using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document))
- {
- editor.CharacterProperties.TrySetFont(new System.Windows.Media.FontFamily("Calibri"));
- editor.InsertRun("PDF/A-3B Compliant Invoice");
- };
- byte[] bytes = File.ReadAllBytes(@"zugferd-invoice.xml");
- document.EmbeddedFiles.AddZugferdInvoice(bytes);
-
- PdfFormatProvider provider = new PdfFormatProvider();
- PdfExportSettings settings = new PdfExportSettings();
- settings.ComplianceLevel = PdfComplianceLevel.PdfA3B;
- provider.ExportSettings = settings;
- using (Stream output = File.OpenWrite("exportedInvoice.pdf"))
- {
- provider.Export(document, output);
- }
-
-{{endregion}}
+
>note Only a single XML invoice attachment is allowed according to ZUGFeRD standard.
@@ -73,14 +43,7 @@ RadPdfProcessing provides support for embedding of [ZUGFeRD](https://de.wikipedi
#### **[C#] Remove ZUGFeRD invoice**
-{{region cs-radpdfprocessing-embedded-file-remove-zugferd-invoice}}
-
- if (document.EmbeddedFiles.ContainsZugferdInvoice)
- {
- document.EmbeddedFiles.RemoveZugferdInvoice();
- }
-
-{{endregion}}
+
### Using the MergedEmbeddedFileNameResolving event
@@ -94,33 +57,7 @@ The **MergedEmbeddedFileNameResolving** event occurs when trying to resolve conf
#### **[C#] Resolving Duplicated Names**
-{{region cs-radpdfprocessing-embedded-file-streams_resolving_2}}
-
- RadFixedDocument doc1 = new RadFixedDocument();
- RadFixedPage page1 = doc1.Pages.AddPage();
- byte[] textFile1 = File.ReadAllBytes(@"..\..\Embedded_File_Streams.txt");
- doc1.EmbeddedFiles.Add("Text file.txt", textFile1);
- byte[] imageFile = File.ReadAllBytes(@"..\..\Basel.JPG");
- doc1.EmbeddedFiles.Add("Basel photo.jpg", imageFile);
-
- RadFixedDocument doc2 = new RadFixedDocument();
- RadFixedPage page2 = doc2.Pages.AddPage();
- byte[] textFile2 = File.ReadAllBytes(@"..\..\Release_Notes.txt");
- doc2.EmbeddedFiles.Add("Text file.txt", textFile2);
-
- doc1.MergedEmbeddedFileNameResolving += (s, a) =>
- {
- string myNewName = "2_" + a.Name;
- if (!a.UsedNames.Contains(myNewName))
- {
- a.NewName = myNewName;
- }
- };
-
- doc1.Merge(doc2);
-
-
-{{endregion}}
+
#### Resolved Duplicated Names

diff --git a/libraries/radpdfprocessing/features/flatten-form-fields.md b/libraries/radpdfprocessing/features/flatten-form-fields.md
index d6eb4701..c862830b 100644
--- a/libraries/radpdfprocessing/features/flatten-form-fields.md
+++ b/libraries/radpdfprocessing/features/flatten-form-fields.md
@@ -18,12 +18,7 @@ The __FlattenFormFields__ method does not take any parameters and will flatten a
#### __[C#] Example 1: Flatten all fields__
-{{region cs-pdfprocessing-features-flatten-form-fields_0}}
-
- RadFixedDocument document = GetFixedDocument();
- document.AcroForm.FlattenFormFields();
-
-{{endregion}}
+
### Using the FlattenFormField method
@@ -31,17 +26,6 @@ The __FlattenFormField__ method takes the field that should be flattened as a pa
#### __[C#] Example 2: Flatten single field__
-{{region cs-pdfprocessing-features-flatten-form-fields_1}}
-
- RadFixedDocument document = GetFixedDocument();
- string fieldName = "TextBoxField";
-
- FormField field = document.AcroForm.FormFields.Where(n => n.Name == fieldName).FirstOrDefault();
- if (field != null)
- {
- document.AcroForm.FlattenFormField(field);
- }
-
-{{endregion}}
+
diff --git a/libraries/radpdfprocessing/features/search.md b/libraries/radpdfprocessing/features/search.md
index cbae94cf..5332e534 100644
--- a/libraries/radpdfprocessing/features/search.md
+++ b/libraries/radpdfprocessing/features/search.md
@@ -17,17 +17,9 @@ This feature allows you to search for a specific text in a PDF document. You can
This class exposes methods for searching. You need to pass an instance of [RadFixedDocument]({%slug radpdfprocessing-model-radfixeddocument%}) when creating a new instance. This is the document that will be searched.
-#### __[C#] Example 1: Create TextSerch Instance__
+#### __[C#] Example 1: Create TextSearch Instance__
-{{region cs-pdfprocessing-features-search_0}}
-
- PdfFormatProvider provider = new PdfFormatProvider();
- RadFixedDocument document = provider.Import(File.ReadAllBytes(@"Test.pdf"), TimeSpan.FromSeconds(10));
-
- TextSearch search = new TextSearch(document);
- IEnumerable result = search.FindAll("Lorem", TextSearchOptions.Default);
-
-{{endregion}}
+
### Search Methods
@@ -50,25 +42,7 @@ All of the above methods return one or more instances of the **SearchResult** cl
#### __[C#] Example 2: Searching in a document__
-{{region cs-pdfprocessing-features-search_1}}
-
- PdfFormatProvider provider = new PdfFormatProvider();
- RadFixedDocument document = provider.Import(File.ReadAllBytes(@"Test.pdf"), TimeSpan.FromSeconds(10));
-
- TextSearch search = new TextSearch(document);
- IEnumerable result = search.FindAll("Lorem", TextSearchOptions.Default);
-
- foreach (SearchResult resultItem in result)
- {
- Rect rect = resultItem.GetWordBoundingRect();
- RadFixedPage page = resultItem.GetResultPage();
- FixedContentEditor editor = new FixedContentEditor(page);
- editor.DrawRectangle(rect);
- }
-
- File.WriteAllBytes(@"result.pdf", provider.Export(document, TimeSpan.FromSeconds(10)));
-
-{{endregion}}
+
### TextSearchOptions
diff --git a/libraries/radpdfprocessing/formats-and-conversion/convert-to-image/using-image-format-provider.md b/libraries/radpdfprocessing/formats-and-conversion/convert-to-image/using-image-format-provider.md
index 23c9b9c1..c8aceffe 100644
--- a/libraries/radpdfprocessing/formats-and-conversion/convert-to-image/using-image-format-provider.md
+++ b/libraries/radpdfprocessing/formats-and-conversion/convert-to-image/using-image-format-provider.md
@@ -32,50 +32,14 @@ To convert your documents' pages to images, use the __Export__ method. Note that
#### __[C#] Example 1: Export RadFixedDocument to Image__
-{{region cs-radpdfprocessing-formats-and-conversion-imageformatprovider_0}}
-
- PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
- RadFixedDocument fixedDocument = pdfFormatProvider.Import(File.ReadAllBytes("Sample.pdf"), TimeSpan.FromSeconds(10));
- SkiaImageFormatProvider imageProvider = new SkiaImageFormatProvider();
-
- int count = 1;
- foreach (RadFixedPage page in fixedDocument.Pages)
- {
- byte[] resultImage = imageProvider.Export(page, TimeSpan.FromSeconds(10));
-
- File.WriteAllBytes(@"C:\Temp\Page " + count++ + ".png", resultImage);
- }
-
-{{endregion}}
+
## Exporting Asynchronously
The __ExportAsync__ method allows you to perform the conversion asynchronously.
#### __[C#] Example 2: Export RadFixedDocument to Image Async__
-{{region cs-radpdfprocessing-formats-and-conversion-imageformatprovider_1}}
-
- public async void ExportAsync()
- {
- PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
- RadFixedDocument fixedDocument = pdfFormatProvider.Import(File.ReadAllBytes("Sample.pdf"), TimeSpan.FromSeconds(10));
- SkiaImageFormatProvider imageProvider = new SkiaImageFormatProvider();
-
- int count = 0;
-
- await Parallel.ForEachAsync(fixedDocument.Pages, async (page, token) =>
- {
- int currentCount = Interlocked.Increment(ref count);
-
- byte[]? result = await imageProvider.ExportAsync(page, TimeSpan.FromSeconds(10));
-
- File.WriteAllBytes(@"C:\my_temp\Page" + currentCount + ".png", result);
-
- });
- }
-
-
-{{endregion}}
+
## Export Settings
diff --git a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfformatprovider/pdfformatprovider.md b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfformatprovider/pdfformatprovider.md
index 5a9fa28d..04bb9ca1 100644
--- a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfformatprovider/pdfformatprovider.md
+++ b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfformatprovider/pdfformatprovider.md
@@ -39,16 +39,7 @@ __Example 1__ shows how to use PdfFormatProvider to import a PDF document from a
#### __[C#] Example 1: Import PDF file__
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfformatprovider_0}}
- PdfFormatProvider provider = new PdfFormatProvider();
- RadFixedDocument document;
- using (Stream stream = File.OpenRead("sample.pdf"))
- {
- document = provider.Import(stream, TimeSpan.FromSeconds(10));
-
- // Do your work with the document inside the using statement.
- }
-{{endregion}}
+
@@ -67,13 +58,7 @@ __Example 2__ shows how to use the __Export()__ method of __PdfFormatProvider__
#### __[C#] Example 2: Export PDF file__
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfformatprovider_1}}
- PdfFormatProvider provider = new PdfFormatProvider();
- using (Stream output = File.OpenWrite("sample.pdf"))
- {
- provider.Export(document, output, TimeSpan.FromSeconds(10));
- }
-{{endregion}}
+
>important When exporting a digitally signed document a stream that allows both reading and writing should be passed otherwise an exception is thrown: NotSupportedException: 'Stream does not support reading.' For example, create the output stream like this: 'new FileStream("signed.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite)'.
diff --git a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdffilesource.md b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdffilesource.md
index d8828d3d..6e403f95 100644
--- a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdffilesource.md
+++ b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdffilesource.md
@@ -18,36 +18,14 @@ The **PdfFileSource** class represents the content of an existing PDF file.
To create an instance of PdfFileSource, you should pass a **FileStream** object, containing the PDF document, to the constructor of the class.
#### **[C#] Example 1: Create a PdfFileSource**
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdffilesource_0}}
- using (PdfFileSource fileSource = new PdfFileSource(File.OpenRead(path)))
- {
- // ...
- }
-{{endregion}}
+
PdfFileSource exposes also an additional overload, which allows you to keep the stream you are working with open after disposing the PdfFileSource instance by passing **true** as a value for the second constructor parameter (*leaveStreamOpen*).
An additional option you can use is the overload that accepts a parameter of type [**PdfImportSettings**]({%slug radpdfprocessing-formats-and-conversion-pdf-settings%}#import-settings). This overload enables you to handle password encrypted documents.
#### **[C#] Example 2: Open encrypted document**
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdffilesource_1}}
-
- public void ReadDocument(string path)
- {
- PdfImportSettings importSettings = new PdfImportSettings();
- importSettings.UserPasswordNeeded += this.Settings_UserPasswordNeeded;
-
- using (PdfFileSource fileSource = new PdfFileSource(File.OpenRead(path), importSettings, leaveStreamOpen: false))
- {
- // ...
- }
- }
-
- private void Settings_UserPasswordNeeded(object sender, PasswordNeededEventArgs e)
- {
- e.Password = "pass";
- }
-{{endregion}}
+
>PdfFileSource inherits from [IDisposable](https://msdn.microsoft.com/en-us/library/system.idisposable(v=vs.110).aspx). Make sure the object is disposed when you are done with it. The best way to ensure this is handled properly is to wrap it in a using statement.
@@ -56,16 +34,7 @@ An additional option you can use is the overload that accepts a parameter of typ
PdfFileSource exposes the **Pages** property, which is of type [PdfPageSource]({%slug radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdfpagesource%})[] and allows you access the pages of the imported document.
#### **[C#] Example 3: Iterate the pages of a document**
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdffilesource_2}}
-
- using (PdfFileSource fileSource = new PdfFileSource(File.OpenRead(path)))
- {
- foreach (PdfPageSource pageSource in fileSource.Pages)
- {
- // ...
- }
- }
-{{endregion}}
+
>You can use the indexer of the Pages property to obtain a specific page of the document and split it. Then, you can save the separated page using [PdfStreamWriter]({%slug radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdfstreamwriter%}).
diff --git a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfpagesource.md b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfpagesource.md
index 70c02b6c..4c4a81b1 100644
--- a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfpagesource.md
+++ b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfpagesource.md
@@ -19,16 +19,7 @@ An instance of the PdfPageSource class can be obtained using the **Pages** prope
#### **[C#] Example 1: Obtain an instance of PdfPageSource**
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdfpagesource_0}}
-
- using (PdfFileSource fileSource = new PdfFileSource(File.OpenRead(path)))
- {
- foreach (PdfPageSource pageSource in fileSource.Pages)
- {
- // ...
- }
- }
-{{endregion}}
+
### Members
@@ -43,28 +34,7 @@ PdfPageSource exposes the following properties to give you information about the
#### **[C#] Example 2: Merge the pages of several documents**
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdfpagesource_2}}
-
- // Create a PdfStreamWriter instance, responsible to write the document into the specified file
- using (PdfStreamWriter fileWriter = new PdfStreamWriter(File.OpenWrite(resultFile)))
- {
- // Iterate through the files you would like to merge
- foreach(string documentName in documentsToMerge)
- {
- // Open each of the files
- using (PdfFileSource fileToMerge = new PdfFileSource(File.OpenRead(documentName)))
- {
- // Iterate through the pages of the current document
- foreach(PdfPageSource pageToMerge in fileToMerge.Pages)
- {
- // Append the current page to the fileWriter, which holds the stream of the result file
- fileWriter.WritePage(pageToMerge);
- }
- }
- }
- }
-
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfpagestreamwriter.md b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfpagestreamwriter.md
index 3e3028b4..10eb5749 100644
--- a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfpagestreamwriter.md
+++ b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfpagestreamwriter.md
@@ -20,19 +20,7 @@ An instance of the PdfPageStreamWriter class can be obtained using the **BeginPa
#### **[C#] Example 1: Instantiate PdfPageStreamWriter**
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdfpagestreamwriter_0}}
-
- using (PdfStreamWriter writer = new PdfStreamWriter(File.OpenWrite(resultDocument)))
- {
- Size size = new Size(700,1200);
- Rotation rotation = Rotation.Rotate270;
-
- using (PdfPageStreamWriter pageWriter = writer.BeginPage(size, rotation))
- {
- // Use the pageWriter object to fill the content of the page.
- }
- }
-{{endregion}}
+
>You can find an example on how to use the PdfPageStreamWriter class in the [Manipulate Pages](https://github.com/telerik/document-processing-sdk/tree/master/PdfProcessing/ManipulatePages) example in the XAML SDK repository on GitHub.
diff --git a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfstreamwriter.md b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfstreamwriter.md
index a9fa24aa..8c2f3e70 100644
--- a/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfstreamwriter.md
+++ b/libraries/radpdfprocessing/formats-and-conversion/pdf/pdfstreamwriter/pdfstreamwriter.md
@@ -29,13 +29,7 @@ To create an object of type PdfSteamWriter, you should pass it the Stream of the
#### **[C#] Example 1: Instantiate PdfStreamWriter**
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdfstreamwriter_0}}
-
- using (PdfStreamWriter writer = new PdfStreamWriter(File.OpenWrite(resultDocument)))
- {
- // ...
- }
-{{endregion}}
+
**PdfStreamWriter** exposes also an additional overload, which allows you to keep the stream you are working with open after disposing the writer instance by passing **true** as a value for the second constructor parameter (leaveStreamOpen).
@@ -53,14 +47,7 @@ The constructor of **PdfStreamWriter** enables you to use any class inheriting f
#### **[C#] Example 2: Instantiate PdfStreamWriter with MemoryStream**
-{{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdfstreamwriter_3}}
-
- MemoryStream stream = new MemoryStream();
- using (PdfStreamWriter writer = new PdfStreamWriter(stream, true))
- {
- // ...
- }
-{{endregion}}
+
## PdfStreamWriter Members
@@ -70,32 +57,13 @@ The members of the class allow you to set several properties of the document you
#### **[C#] Example 3: Insert a new page into a document**
- {{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdfstreamwriter_1}}
-
- using (PdfStreamWriter writer = new PdfStreamWriter(File.OpenWrite(resultDocument)))
- {
- Size size = new Size(700,1200);
- Rotation rotation = Rotation.Rotate270;
-
- using (PdfPageStreamWriter pageWriter = writer.BeginPage(size, rotation))
- {
- // Use the pageWriter object to fill the content of the page.
- }
- }
- {{endregion}}
+
* **WritePage()**: The WritePage() methods enable you to pass an already constructed page object. With the different overloads, you can pass an instance of [**RadFixedPage**]() and [**PdfPageStreamWriter**]().
#### **[C#] Example 4: Insert an already generated page into a document**
- {{region cs-radpdfprocessing-formats-and-conversion-pdf-pdfstreamwriter-pdfstreamwriter_2}}
-
- using (PdfStreamWriter writer = new PdfStreamWriter(File.OpenWrite(resultDocument)))
- {
- RadFixedPage page = this.GeneratePage();
- writer.WritePage(page);
- }
- {{endregion}}
+
### Settings of PdfStreamWriter
diff --git a/libraries/radpdfprocessing/formats-and-conversion/plain-text/settings.md b/libraries/radpdfprocessing/formats-and-conversion/plain-text/settings.md
index 05c940f2..b33f4334 100644
--- a/libraries/radpdfprocessing/formats-and-conversion/plain-text/settings.md
+++ b/libraries/radpdfprocessing/formats-and-conversion/plain-text/settings.md
@@ -31,10 +31,7 @@ The constructor of the **TextFormatProviderSettings** class has two overloads:
**Example 1** shows how to create and specify a particular setting.
#### **[C#] Example 1: Create TextFormatProviderSettings**
-{{region cs-radpdfprocessing-formats-and-conversion-plain-text-settings_0}}
-
- TextFormatProviderSettings settings = new TextFormatProviderSettings("/r/n", "*Page {0}*");
-{{endregion}}
+
## Using TextFormatProviderSettings
@@ -44,13 +41,7 @@ The __Export()__ method of **TextFormatProvider** allows you to pass a **TextFor
#### **[C#] Example 2: Apply TextFormatProviderSettings**
-{{region cs-radpdfprocessing-formats-and-conversion-plain-text-settings_1}}
-
- RadFixedDocument document = CreateRadFixedDocument();
-
- TextFormatProvider provider = new TextFormatProvider();
- string text = provider.Export(document, settings);
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/formats-and-conversion/plain-text/text.md b/libraries/radpdfprocessing/formats-and-conversion/plain-text/text.md
index 08a06a20..86af0881 100644
--- a/libraries/radpdfprocessing/formats-and-conversion/plain-text/text.md
+++ b/libraries/radpdfprocessing/formats-and-conversion/plain-text/text.md
@@ -7,12 +7,8 @@ published: True
position: 0
---
-
-
# Plain text
-
-
Plain text is the contents of an ordinary sequential document readable as textual material without much processing.

diff --git a/libraries/radpdfprocessing/formats-and-conversion/plain-text/textformatprovider.md b/libraries/radpdfprocessing/formats-and-conversion/plain-text/textformatprovider.md
index 0f479a66..5a463d14 100644
--- a/libraries/radpdfprocessing/formats-and-conversion/plain-text/textformatprovider.md
+++ b/libraries/radpdfprocessing/formats-and-conversion/plain-text/textformatprovider.md
@@ -29,18 +29,7 @@ __Example 1__ shows how to use __TextFormatProvider__ to export __RadFixedDocume
#### __[C#] Example 1: Export RadFixedDocument to string__
-{{region cs-radpdfprocessing-formats-and-conversion-plain-text-textformatprovider_0}}
- Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider textFormatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Text.TextFormatProvider();
-
- RadFixedDocument document = new RadFixedDocument();
- using (RadFixedDocumentEditor radFixedDocumentEditor = new RadFixedDocumentEditor(document))
- {
- radFixedDocumentEditor.InsertLine("Sample line.");
- radFixedDocumentEditor.InsertRun("Sample run.");
- }
-
- string documentAsText = textFormatProvider.Export(document, TimeSpan.FromSeconds(10));
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/getting-started.md b/libraries/radpdfprocessing/getting-started.md
index 73e70174..044b87ba 100644
--- a/libraries/radpdfprocessing/getting-started.md
+++ b/libraries/radpdfprocessing/getting-started.md
@@ -114,10 +114,7 @@ In order to use the __RadPdfProcessing__ library in your project, you need to ad
#### __[C#] Example 1: Create RadFixedDocument__
-{{region cs-radpdfprocessing-getting-started_0}}
- RadFixedDocument document = new RadFixedDocument();
- RadFixedPage page = document.Pages.AddPage();
-{{endregion}}
+
@@ -126,10 +123,7 @@ The page can then be edited through a [FixedContentEditor]({%slug radpdfprocessi
#### __[C#] Example 2: Add text__
-{{region cs-radpdfprocessing-getting-started_1}}
- FixedContentEditor editor = new FixedContentEditor(page);
- editor.DrawText("Hello RadPdfProcessing!");
-{{endregion}}
+
@@ -140,13 +134,7 @@ Exporting to PDF format can be achieved with the __PdfFormatProvider__ class. __
#### __[C#] Example 3: Export to PDF__
-{{region cs-radpdfprocessing-getting-started_2}}
- PdfFormatProvider provider = new PdfFormatProvider();
- using (Stream output = File.OpenWrite("Hello.pdf"))
- {
- provider.Export(document, output);
- }
-{{endregion}}
+
For more complete examples head to the [Developer Focused Examples]({%slug radpdfprocessing-sdk-examples%}) section of the library.
diff --git a/libraries/radpdfprocessing/model/actions/js-actions/action-collections.md b/libraries/radpdfprocessing/model/actions/js-actions/action-collections.md
index 36a747bf..f4b52d46 100644
--- a/libraries/radpdfprocessing/model/actions/js-actions/action-collections.md
+++ b/libraries/radpdfprocessing/model/actions/js-actions/action-collections.md
@@ -68,22 +68,7 @@ It is suitable for cases when a certain calculation needs to be performed after
A common case is restricting the user's input, e.g. when entering a date in a specific format:
-```csharp
-
- RadFixedDocument document = new RadFixedDocument();
- document.Pages.AddPage();
-
- TextBoxField textField = new TextBoxField("SampleTextBox");
- textField.Actions.Format = new Telerik.Windows.Documents.Fixed.Model.Actions.JavaScriptAction("AFDate_FormatEx(\"m/d/yy\");");
- textField.Actions.Keystroke = new Telerik.Windows.Documents.Fixed.Model.Actions.JavaScriptAction("AFDate_KeystrokeEx(\"m/d/yy\");");
-
- VariableContentWidget widget = textField.Widgets.AddWidget();
- widget.Rect = new Rect(new Size(250, 50));
-
- document.AcroForm.FormFields.Add(textField);
- document.Pages[0].Annotations.Add(widget);
-
-```
+
The achieved result is illustrated below:
@@ -100,16 +85,7 @@ Represents a collection of Action objects associated with a [RadFixedPage]({%slu
The following example shows how to utilize the JavaScript Actions functionality showing an alert when the second page in a document is closed
-```csharp
-
- RadFixedDocument document = new RadFixedDocument();
- document.Pages.AddPage();//first page
- RadFixedPage page = document.Pages.AddPage();//second page
- JavaScriptAction action = new JavaScriptAction("app.alert('JS Action when second page is closed!');");
- page.Actions.OnPageClose.Add(action);
- document.Pages.AddPage();//third page
-
-```
+

diff --git a/libraries/radpdfprocessing/model/actions/js-actions/javascript-actions.md b/libraries/radpdfprocessing/model/actions/js-actions/javascript-actions.md
index 72440c22..49e8b326 100644
--- a/libraries/radpdfprocessing/model/actions/js-actions/javascript-actions.md
+++ b/libraries/radpdfprocessing/model/actions/js-actions/javascript-actions.md
@@ -41,47 +41,12 @@ The following example demonstrates how to create a PDF document with three TextB

-```csharp
-
- RadFixedDocument document = new RadFixedDocument();
- document.Pages.AddPage();
-
- TextBoxField field1 = new TextBoxField("Field1");
- VariableContentWidget widget1 = field1.Widgets.AddWidget();
- widget1.Rect = new Rect(new Size(150, 30));
-
- TextBoxField field2 = new TextBoxField("Field2");
- VariableContentWidget widget2 = field2.Widgets.AddWidget();
- widget2.Rect = new Rect(new Point(0, 50), new Size(150, 30));
-
- TextBoxField totalField = new TextBoxField("Total");
- totalField.IsReadOnly = true;
- totalField.Actions.Calculate = new Telerik.Windows.Documents.Fixed.Model.Actions.JavaScriptAction
- ("AFSimple_Calculate(\"SUM\", new Array (\"Field1\", \"Field2\"));");
- VariableContentWidget totalWidget = totalField.Widgets.AddWidget();
- totalWidget.Rect = new Rect(new Point(0, 100), new Size(150, 30));
-
- document.AcroForm.FormFields.Add(field1);
- document.AcroForm.FormFields.Add(field2);
- document.AcroForm.FormFields.Add(totalField);
- document.Pages[0].Annotations.Add(widget1);
- document.Pages[0].Annotations.Add(widget2);
- document.Pages[0].Annotations.Add(totalWidget);
-
-```
+
### Using the MergedJavaScriptNameResolving Event
The event is fired when trying to resolve conflicts between the JavaScript names while merging RadFixedDocument instances.
-```csharp
-document.MergedJavaScriptNameResolving += (sender, e) =>
-{
- if (e.UsedNames.Contains(e.Name))
- {
- e.NewName = e.Name + "1";
- }
-};
-```
+
## See Also
diff --git a/libraries/radpdfprocessing/model/annotations/line.md b/libraries/radpdfprocessing/model/annotations/line.md
index 4015d110..5aa75d9f 100644
--- a/libraries/radpdfprocessing/model/annotations/line.md
+++ b/libraries/radpdfprocessing/model/annotations/line.md
@@ -27,17 +27,7 @@ The **LineAnnotation** class is a derivative of the **MarkupAnnotation** (descen
### Creating a LineAnnotation
-```csharp
- RadFixedDocument document = new RadFixedDocument();
- RadFixedPage page = document.Pages.AddPage();
-
- LineAnnotation annotation = page.Annotations.AddLine(new Point(50, 50), new Point(300, 300));
- annotation.StartLineEndingType = LineEndingType.None;
- annotation.EndLineEndingType = LineEndingType.OpenArrow;
- annotation.Color = new RgbColor(255, 0, 0); //Default RgbColor(255, 255, 255)
- annotation.Contents = "This is a LineAnnotation";
- annotation.Opacity = 0.5;
-```
+

@@ -45,14 +35,7 @@ The **LineAnnotation** class is a derivative of the **MarkupAnnotation** (descen
The [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) offers the public **DrawLineAnnotation** method which creates a new __LineAnnotation__ with starting point the current point of the editor and end point the current point of the editor plus the given distances.
-```csharp
- RadFixedDocument fixedDocument = new RadFixedDocument();
- FixedContentEditor editor = new FixedContentEditor(fixedDocument.Pages.AddPage());
-
- editor.Position.Translate(50, 50);
- editor.DrawText("Line starts here.");
- editor.DrawLineAnnotation(100, 200);
-```
+

diff --git a/libraries/radpdfprocessing/model/annotations/links.md b/libraries/radpdfprocessing/model/annotations/links.md
index 8fd8d7f9..4865e44e 100644
--- a/libraries/radpdfprocessing/model/annotations/links.md
+++ b/libraries/radpdfprocessing/model/annotations/links.md
@@ -21,10 +21,7 @@ __Link__ exposes the following properties:
#### __[C#] Example 1: Add link to destination__
- {{region cs-radpdfprocessing-model-annotations-links_0}}
- Link linkWithDestination = new Link(destination);
- page.Annotations.Add(linkWithDestination);
- {{endregion}}
+
* **NamedDestination**: A named destination associated with the link.
@@ -35,10 +32,7 @@ __Link__ exposes the following properties:
#### __[C#] Example 2: Add link with action__
- {{region cs-radpdfprocessing-model-annotations-links_1}}
- Link linkWithAction = new Link(action);
- page.Annotations.Add(linkWithAction);
- {{endregion}}
+
@@ -87,16 +81,7 @@ __Example 3__ shows how you can create a Location object, associate it with a Li
#### __[C#] Example 3: Add link with location__
-{{region cs-radpdfprocessing-model-annotations-links_2}}
- Location location = new Location();
- location.Left = 225;
- location.Top = 500;
- location.Zoom = 4;
- location.Page = secondPage;
-
- var link = firstPage.Annotations.AddLink(location);
- link.Rect = new Rect(10, 10, 50, 50);
-{{endregion}}
+
@@ -107,19 +92,7 @@ __Example 4__ demonstrates how to create an action of type __GoToAction__, assoc
#### __[C#] Example 4: Add link with action__
-{{region cs-radpdfprocessing-model-annotations-links_3}}
- GoToAction goToAction = new GoToAction();
- goToAction.Destination = location;
-
- var goToLink = firstPage.Annotations.AddLink(goToAction);
- goToLink.Rect = new Rect(10, 10, 50, 50);
-
- UriAction uriAction = new UriAction();
- uriAction.Uri = new Uri(@"http://www.telerik.com");
-
- var uriLink = firstPage.Annotations.AddLink(uriAction);
- uriLink.Rect = new Rect(70, 10, 50, 50);
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/annotations/stamp.md b/libraries/radpdfprocessing/model/annotations/stamp.md
index 2a4d273b..0168f60f 100644
--- a/libraries/radpdfprocessing/model/annotations/stamp.md
+++ b/libraries/radpdfprocessing/model/annotations/stamp.md
@@ -24,22 +24,7 @@ The **StampAnnotation** class is a derivative of the **MarkupAnnotation** (desce
### Creating a StampAnnotation
-```csharp
- RadFixedDocument fixedDocument = new RadFixedDocument();
- RadFixedPage page = fixedDocument.Pages.AddPage();
-
- StampAnnotation annotation1 = page.Annotations.AddStamp(new Rect(50, 50, 300, 50));
- annotation1.Name = StampAnnotationPredefinedNames.SBApproved;
-
- StampAnnotation annotation2 = page.Annotations.AddStamp(new Rect(50, 100, 300, 50));
- annotation2.Name = StampAnnotationPredefinedNames.SBPreliminaryResults;
-
- StampAnnotation annotation3 = page.Annotations.AddStamp(new Rect(50, 150, 300, 50));
- annotation3.Name = StampAnnotationPredefinedNames.SBRejected;
-
- StampAnnotation annotation4 = page.Annotations.AddStamp(new Rect(50, 200, 300, 50));
- annotation4.Name = StampAnnotationPredefinedNames.SBVoid;
-```
+

@@ -47,15 +32,7 @@ The **StampAnnotation** class is a derivative of the **MarkupAnnotation** (desce
The [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) offers the public **DrawStampAnnotation** method which creates a new __StampAnnotation__ and draws it with a specified annotation size and name.
-```csharp
- RadFixedDocument fixedDocument = new RadFixedDocument();
- FixedContentEditor editor = new FixedContentEditor(fixedDocument.Pages.AddPage());
-
- editor.Position.Translate(100, 100);
- editor.DrawStampAnnotation(new Size(250, 250), StampAnnotationPredefinedNames.SBFinal);
- editor.Position.Translate(400, 100);
- editor.DrawStampAnnotation(new Size(250, 250), StampAnnotationPredefinedNames.SBConfidential);
-```
+

@@ -67,46 +44,7 @@ The **AnnotationContentSource** class, accessed by the **Content** property of t
>important When creating appearance for an annotation, it is important to create it with the same size as the rectangle of the annotation otherwise unexpected behavior may occur when the annotation is moved in Adobe.
-```csharp
- private RadFixedDocument CreateTextAnnotation()
- {
- RadFixedDocument fixedDocument = new RadFixedDocument();
- RadFixedPage page = fixedDocument.Pages.AddPage();
-
- StampAnnotation annotation = page.Annotations.AddStamp(new Rect(100, 100, 300, 100));
- annotation.Name = "#Sold";
-
- FormSource simpleForm = new FormSource();
- CreateContentFormWithText(simpleForm, "Sold");
-
- AnnotationContentSource content = new AnnotationContentSource();
- annotation.Content.NormalContentSource = simpleForm;
- return fixedDocument;
- }
-
- private static void CreateContentFormWithText(FormSource normalForm, string text)
- {
- normalForm.Size = new Size(300, 100);
-
- FixedContentEditor formEditor = new FixedContentEditor(normalForm);
-
- using (formEditor.SaveProperties())
- {
- formEditor.GraphicProperties.IsFilled = true;
- formEditor.GraphicProperties.IsStroked = true;
- formEditor.GraphicProperties.StrokeThickness = 2;
- formEditor.GraphicProperties.StrokeColor = new RgbColor(92, 229, 0);
- formEditor.GraphicProperties.FillColor = new RgbColor(213, 222, 226);
- formEditor.GraphicProperties.StrokeDashArray = new double[] { 17, 4 };
- formEditor.DrawRectangle(new Rect(formEditor.Position.Matrix.OffsetX, formEditor.Position.Matrix.OffsetY, 300,100));
- }
-
- formEditor.TextProperties.FontSize = 20;
- formEditor.TextProperties.Font = FontsRepository.Courier;
- formEditor.Position.Translate(10, 10);
- formEditor.DrawText(text);
- }
-```
+

diff --git a/libraries/radpdfprocessing/model/annotations/text-markup.md b/libraries/radpdfprocessing/model/annotations/text-markup.md
index 63c4a0fa..527d81d1 100644
--- a/libraries/radpdfprocessing/model/annotations/text-markup.md
+++ b/libraries/radpdfprocessing/model/annotations/text-markup.md
@@ -30,77 +30,14 @@ Depending on the TextMarkupAnnotationType the respective type of the TextMarkup
### Creating a Highlight Annotation
-```csharp
- string sampleText = File.ReadAllText("dummyText.txt");
-
- RadFixedDocument fixedDocument = new RadFixedDocument();
- using (RadFixedDocumentEditor documentEditor = new RadFixedDocumentEditor(fixedDocument))
- {
- documentEditor.InsertRun(sampleText);
- }
- TextSearch search = new TextSearch(fixedDocument);
- IEnumerable result = search.FindAll("amet", TextSearchOptions.Default);
- foreach (SearchResult r in result)
- {
- Rect highlightRectangle = r.GetWordBoundingRect();
- TextMarkupAnnotation annotation = r.GetResultPage().Annotations.AddHighlight(highlightRectangle);
- annotation.Color = new RgbColor(125, 255, 0, 0);
-
- annotation.RecalculateContent();
- }
-
-```
+

### Creating a Highlight Annotation with Appearance
-```csharp
- private RadFixedDocument CreateTextMarkupAnnotation()
- {
- string sampleText = File.ReadAllText("dummyText.txt");
- RadFixedDocument fixedDocument = new RadFixedDocument();
- using (RadFixedDocumentEditor documentEditor = new RadFixedDocumentEditor(fixedDocument))
- {
- documentEditor.InsertRun(sampleText);
- }
- TextMarkupAnnotation annotation = fixedDocument.Pages[0].Annotations.AddHighlight(new Rect(150, 150, 100, 40));
-
- FormSource simpleForm = new FormSource();
- CreateContentFormWithText(simpleForm, "Hover me!");
- annotation.Content.NormalContentSource = simpleForm;
-
- FormSource secondForm = new FormSource();
- CreateContentFormWithText(secondForm, "Hovered!");
- annotation.Content.MouseOverContentSource = secondForm;
- return fixedDocument;
- }
-
- private static void CreateContentFormWithText(FormSource normalForm, string text)
- {
- Size s = new Size(100, 40);
- normalForm.Size = s;
-
- FixedContentEditor formEditor = new FixedContentEditor(normalForm);
-
- using (formEditor.SaveProperties())
- {
- formEditor.GraphicProperties.IsFilled = true;
- formEditor.GraphicProperties.IsStroked = true;
- formEditor.GraphicProperties.StrokeThickness = 1;
- formEditor.GraphicProperties.StrokeColor = new RgbColor(255, 0, 0);
- formEditor.GraphicProperties.FillColor = new RgbColor(175,255, 255, 0);
- formEditor.GraphicProperties.StrokeDashArray = new double[] { 17, 4 };
- formEditor.DrawRectangle(new Rect(s));
- }
-
- formEditor.TextProperties.FontSize = 16;
- formEditor.TextProperties.Font = FontsRepository.Courier;
- formEditor.Position.Translate(10, 10);
- formEditor.DrawText(text);
- }
-```
+

@@ -108,61 +45,19 @@ Depending on the TextMarkupAnnotationType the respective type of the TextMarkup
## Underline
-```csharp
- RadFixedDocument fixedDocument = new RadFixedDocument();
- RadFixedPage page = fixedDocument.Pages.AddPage();
- FixedContentEditor editor = new FixedContentEditor(page);
- editor.Position.Translate(100, 100);
- editor.DrawText("This is an underline.");
-
- TextSearch search = new TextSearch(fixedDocument);
- IEnumerable underlineSearch = search.FindAll("underline", TextSearchOptions.Default);
- Rect underlineRectangle = underlineSearch.First().GetWordBoundingRect();
- TextMarkupAnnotation underlineAnnotation = page.Annotations.AddUnderline(underlineRectangle);
- underlineAnnotation.Color = new RgbColor(255, 0, 255);
- underlineAnnotation.Opacity = 0.90;
- underlineAnnotation.RecalculateContent();
-```
+

## Squiggly
-```csharp
- RadFixedDocument fixedDocument = new RadFixedDocument();
- RadFixedPage page = fixedDocument.Pages.AddPage();
- FixedContentEditor editor = new FixedContentEditor(page);
- editor.Position.Translate(100, 100);
- editor.DrawText("This is a squiggly line.");
-
- TextSearch search = new TextSearch(fixedDocument);
- IEnumerable squigglySearch = search.FindAll("squiggly", TextSearchOptions.Default);
- Rect squigglyRectangle = squigglySearch.First().GetWordBoundingRect();
- TextMarkupAnnotation squigglyAnnotation = page.Annotations.AddSquiggly(squigglyRectangle);
- squigglyAnnotation.Color = new RgbColor (255,0, 0);
- squigglyAnnotation.Opacity = 0.70;
- squigglyAnnotation.RecalculateContent();
-```
+

## StrikeOut
-```csharp
- RadFixedDocument fixedDocument = new RadFixedDocument();
- RadFixedPage page = fixedDocument.Pages.AddPage();
- FixedContentEditor editor = new FixedContentEditor(page);
- editor.Position.Translate(100, 100);
- editor.DrawText("This is a strikeout.");
-
- TextSearch search = new Search.TextSearch(fixedDocument);
- IEnumerable strikeoutSearch = search.FindAll("strikeout", TextSearchOptions.Default);
- Rect strikeoutRectangle = strikeoutSearch.First().GetWordBoundingRect();
- TextMarkupAnnotation strikeoutAnnotation = page.Annotations.AddStrikeout(strikeoutRectangle);
- strikeoutAnnotation.Color = new RgbColor(0, 0, 255);
- strikeoutAnnotation.Opacity = 0.90;
- strikeoutAnnotation.RecalculateContent();
-```
+

diff --git a/libraries/radpdfprocessing/model/annotations/text.md b/libraries/radpdfprocessing/model/annotations/text.md
index 9549cf29..058002d5 100644
--- a/libraries/radpdfprocessing/model/annotations/text.md
+++ b/libraries/radpdfprocessing/model/annotations/text.md
@@ -26,19 +26,7 @@ The **TextAnnotation** class is a derivative of the **MarkupAnnotation** (descen
### Creating a TextAnnotation
-```csharp
- string sampleText = "sample text here";
- RadFixedDocument fixedDocument = new RadFixedDocument();
- using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(fixedDocument))
- {
- editor.InsertRun(sampleText);
- }
- RadFixedPage page = fixedDocument.Pages[0];
- TextAnnotation annotation = page.Annotations.AddText(new Rect(200, 100, 200, 200));
- annotation.Contents = "This is a TextAnnotation";
- annotation.Opacity = 0.5;
- annotation.Color = new RgbColor(255, 0, 0); //Default RgbColor(255, 255, 255)
-```
+

@@ -46,17 +34,7 @@ The **TextAnnotation** class is a derivative of the **MarkupAnnotation** (descen
The FixedContentEditor offers the public **DrawTextAnnotation** method which creates a new TextAnnotation and draws it with a specified size and text and can create a PopupAnnotation to go with it.
-```csharp
- RadFixedDocument fixedDocument = new RadFixedDocument();
- FixedContentEditor editor = new FixedContentEditor(fixedDocument.Pages.AddPage());
- editor.Position.Translate(100, 100);
- Size annotationSize = new Size(50, 50);
- Size popupSize = new Size(250, 100);
- string text = "This is a TextAnnotation";
- bool addPopup = true;
- editor.DrawTextAnnotation(annotationSize, popupSize, text, addPopup);
- PopupAnnotation popupAnnotation = fixedDocument.Pages[0].Annotations[1] as PopupAnnotation;
-```
+

@@ -66,49 +44,7 @@ The **AnnotationContentSource** class, accessed by the **Content** property of t
>important In **.NET Standard/.NET (Target OS: None)** environments, fonts beyond the [14 standard ones]({%slug radpdfprocessing-concepts-fonts%}#standard-fonts) require a [FontsProvider implementation]({%slug pdfprocessing-implement-fontsprovider%}) to be resolved correctly.
-```csharp
- private RadFixedDocument CreateTextAnnotation()
- {
- RadFixedDocument fixedDocument = new RadFixedDocument();
- RadFixedPage page = fixedDocument.Pages.AddPage();
-
- TextAnnotation annotation = page.Annotations.AddText(new Rect(100, 100, 100, 50));
- annotation.Contents = "This is a TextAnnotation";
- FormSource normalForm = new FormSource();
- CreateContentFormWithText(normalForm, "Hover me");
- FormSource hoverForm = new FormSource();
- CreateContentFormWithText(hoverForm, "Done");
-
- annotation.Content.NormalContentSource = normalForm;
- annotation.Content.MouseOverContentSource = hoverForm;
- return fixedDocument;
- }
-
- private static void CreateContentFormWithText(FormSource normalForm, string text)
- {
- Size s = new Size(100, 40);
- Random rand = new Random();
- normalForm.Size = s;
-
- FixedContentEditor formEditor = new FixedContentEditor(normalForm);
-
- using (formEditor.SaveProperties())
- {
- formEditor.GraphicProperties.IsFilled = true;
- formEditor.GraphicProperties.IsStroked = true;
- formEditor.GraphicProperties.StrokeThickness = 1;
- formEditor.GraphicProperties.StrokeColor = new RgbColor(255, 0, 0);
- formEditor.GraphicProperties.FillColor = new RgbColor(255, 255, 0);
- formEditor.GraphicProperties.StrokeDashArray = new double[] { 17, 4 };
- formEditor.DrawRectangle(new Rect(s));
- }
-
- formEditor.TextProperties.FontSize = 10;
- formEditor.TextProperties.Font = FontsRepository.Courier;
- formEditor.Position.Translate(10, 10);
- formEditor.DrawText(text);
- }
-```
+

diff --git a/libraries/radpdfprocessing/model/annotations/widgets.md b/libraries/radpdfprocessing/model/annotations/widgets.md
index 54f84eef..f7793ac4 100644
--- a/libraries/radpdfprocessing/model/annotations/widgets.md
+++ b/libraries/radpdfprocessing/model/annotations/widgets.md
@@ -54,10 +54,7 @@ All widgets are created using the Widgets collection of the [FormField]({%slug r
#### **[C#] Example 1: Creating a widget**
-{{region radpdfprocessing-model-annotations-widgets_0}}
- VariableContentWidget widget = textBoxField.Widgets.AddWidget();
- widget.Rect = new Rect(100, 100, 20, 20);
-{{endregion}}
+
>Don't forget to specify the size of the widget. Otherwise, it won't be visualized in the PDF document.
@@ -65,12 +62,7 @@ All widgets are created using the Widgets collection of the [FormField]({%slug r
#### **[C#] Example 2: Iterating the widgets in the FormField's collection**
-{{region radpdfprocessing-model-annotations-widgets_1}}
- foreach (var widget in textBoxField.Widgets)
- {
- document.Pages[0].Annotations.Add(widget);
- }
-{{endregion}}
+
>The Widget class inherits from [Annotation]({%slug radpdfprocessing-model-annotations-overview%}). It is important to add each annotation to the Annotations collection of RadFixedPage.
diff --git a/libraries/radpdfprocessing/model/form.md b/libraries/radpdfprocessing/model/form.md
index cea818a3..4b21e3f9 100644
--- a/libraries/radpdfprocessing/model/form.md
+++ b/libraries/radpdfprocessing/model/form.md
@@ -44,10 +44,7 @@ __Example 1__ shows how to initialize a Form object and add it to a previously d
#### __[C#] Example 1: Create a form and add it to an IContainerElement__
-{{region cs-radpdfprocessing-model-form_0}}
- Form form = new Form();
- container.Content.Add(form);
-{{endregion}}
+
__Example 2__ demonstrates how to use one of the factory methods of the __ContentElementCollection__ to create a new form and insert it into the respective container.
@@ -55,10 +52,7 @@ __Example 2__ demonstrates how to use one of the factory methods of the __Conten
#### __[C#] Example 2: Add a form to a container__
-{{region cs-radpdfprocessing-model-form_1}}
- Form form = container.Content.AddForm();
- Form formWithSource = container.Content.AddForm(formSource);
-{{endregion}}
+
>tipThere are other methods that allow adding a form to a document by passing it size and source. They could be used through the [FixedContentEditor class]({%slug radpdfprocessing-editing-fixedcontenteditor%}).
@@ -72,37 +66,7 @@ You can modify a __Form__ element using the properties the class exposes. The pr
#### __[C#] Example 3: Modify Form properties__
-{{region cs-radpdfprocessing-model-form_2}}
- RadFixedDocument document = new RadFixedDocument();
-
- RadFixedPage page = document.Pages.AddPage();
- FormSource formSource = new FormSource();
- formSource.Size = new Size(200, 200);
- Form form = page.Content.AddForm(formSource);
-
- SimplePosition simplePosition = new SimplePosition();
- simplePosition.Translate(20, 20);
-
- form.Width = 200;
- form.Height = 300;
- form.Position = simplePosition;
- form.AlphaConstant = 0.5;
- form.StrokeAlphaConstant = 0.1;
-
- PathGeometry pathGeometry = new PathGeometry();
- PathFigure pathFigure = pathGeometry.Figures.AddPathFigure();
- pathFigure.StartPoint = new Point(5, 5);
- LineSegment lineSegment = pathFigure.Segments.AddLineSegment();
- lineSegment.Point = new Point(205, 5);
- BezierSegment bezierSegment = pathFigure.Segments.AddBezierSegment();
- bezierSegment.Point1 = new Point(105, 50);
- bezierSegment.Point2 = new Point(130, 105);
- bezierSegment.Point3 = new Point(100, 200);
- pathFigure.IsClosed = true;
-
- FixedContentEditor editor = new FixedContentEditor(formSource);
- editor.DrawPath(pathGeometry);
-{{endregion}}
+

diff --git a/libraries/radpdfprocessing/model/formsource/overview.md b/libraries/radpdfprocessing/model/formsource/overview.md
index 752f7b38..65e5e691 100644
--- a/libraries/radpdfprocessing/model/formsource/overview.md
+++ b/libraries/radpdfprocessing/model/formsource/overview.md
@@ -25,9 +25,7 @@ The FormSource class exposes a default constructor which you can use to create a
#### __[C#] Example 1: Create FormSource__
-{{region cs-radpdfprocessing-model-formsource_0}}
- FormSource formSource = new FormSource();
-{{endregion}}
+
The snippet from **Example 1** will create an empty FormSource object. To fill this object with content you can use [FixedContentEditor]({%slug radpdfprocessing-editing-fixedcontenteditor%}) as described later in this article.
@@ -45,27 +43,7 @@ The FormSource class inherits from the IContentRootElement interface. This inher
#### __[C#] Example 2: Add content to a FormSource__
-{{region cs-radpdfprocessing-model-formsource_1}}
- FormSource simpleForm = new FormSource();
- simpleForm.Size = new Size(310, 250);
-
- FixedContentEditor formEditor = new FixedContentEditor(simpleForm);
- formEditor.Position.Translate(50, 60);
-
- using (formEditor.SaveProperties())
- {
- formEditor.GraphicProperties.IsFilled = true;
- formEditor.GraphicProperties.IsStroked = true;
- formEditor.GraphicProperties.StrokeThickness = 2;
- formEditor.GraphicProperties.StrokeColor = new RgbColor(92, 229, 0);
- formEditor.GraphicProperties.FillColor = new RgbColor( 213, 222, 226);
- formEditor.GraphicProperties.StrokeDashArray = new double[] { 17, 4 };
- formEditor.DrawRectangle(new Rect(new Size(250, 150)));
- }
-
- formEditor.Position.Translate(100, 120);
- formEditor.DrawText("Sample rectangle in a form");
-{{endregion}}
+
## Inserting a FormSource into a Document
@@ -78,15 +56,7 @@ After generating the FormSource object and filling it with content, you should i
#### __[C#] Example 3: Add a FormSource to a document using FixedContentEditor__
- {{region cs-radpdfprocessing-model-formsource_2}}
- FixedContentEditor documentPageEditor = new FixedContentEditor(document.Pages.AddPage());
-
- FormSource simpleForm = new FormSource();
- // Fill the FormSource instance with content (you can use the code from Example 2)
-
- documentPageEditor.DrawForm(simpleForm);
-
- {{endregion}}
+
There are several overloads of the DrawForm() method that enables you to specify the size of the form.
diff --git a/libraries/radpdfprocessing/model/formsource/svg.md b/libraries/radpdfprocessing/model/formsource/svg.md
index 4ef4a70d..29c6a18b 100644
--- a/libraries/radpdfprocessing/model/formsource/svg.md
+++ b/libraries/radpdfprocessing/model/formsource/svg.md
@@ -20,25 +20,7 @@ As of **Q3 2024** RadPdfProcessing provides support for SVG FormSource (vector g
The following example shows how to insert an SVG image into a FormSource object using FixedContentEditor:
-```csharp
-string svgFilePath = "image.svg";
-RadFixedDocument fixedDocument = new RadFixedDocument();
-FixedContentEditor documentPageEditor = new FixedContentEditor(fixedDocument.Pages.AddPage());
-int offset = 10;
-documentPageEditor.Position.Translate(offset, offset);
-
-FormSource svgHostForm = FormSource.FromSvg(File.ReadAllBytes(svgFilePath));
-documentPageEditor.DrawForm(svgHostForm);
-//draw the SVG FormSource with its original size
-
-double aspectRatio = svgHostForm.Size.Width / svgHostForm.Size.Height;
-//get the aspect ratio from the original SVG size
-double desiredSVGWidth = 100;
-double calculatedSVGHeight = desiredSVGWidth / aspectRatio;
-documentPageEditor.Position.Translate(offset, svgHostForm.Size.Height + offset);
-documentPageEditor.DrawForm(svgHostForm, new Size(desiredSVGWidth, calculatedSVGHeight));
-//draw the SVG FormSource with desired width preserving the aspect ratio
-```
+

## See Also
diff --git a/libraries/radpdfprocessing/model/image.md b/libraries/radpdfprocessing/model/image.md
index 6a1065fc..5a478b66 100644
--- a/libraries/radpdfprocessing/model/image.md
+++ b/libraries/radpdfprocessing/model/image.md
@@ -36,25 +36,7 @@ __Example 1__ shows how to initialize an Image object, assigns an ImageSource to
#### __[C#] Example 1: Create image__
-{{region cs-radpdfprocessing-model-image_0}}
- RadFixedDocument fixedDocument = new RadFixedDocument();
- RadFixedPage fixedPage = fixedDocument.Pages.AddPage();
-
- Image image = new Image();
- string imageFilePath = "ProgressNinjas.png";
- using (FileStream fileStream = new FileStream(imageFilePath, FileMode.Open))
- {
- ImageSource imageSrc = new ImageSource(fileStream);
- image.ImageSource = imageSrc;
- image.Width = 200;
- image.Height = 200;
- image.AlphaConstant = 0.5;
- SimplePosition simplePosition = new SimplePosition();
- simplePosition.Translate(200, 300);
- image.Position = simplePosition;
- fixedPage.Content.Add(image);
- }
-{{endregion}}
+
Once the above RadFixedDocument is [exported]({%slug radpdfprocessing-formats-and-conversion-pdf-pdfformatprovider%}), the following document with an image is created:
@@ -64,10 +46,7 @@ __Example 2__ demonstrates how to use one of the factory methods of the __Conten
#### __[C#] Example 2: Add image to container__
-{{region cs-radpdfprocessing-model-image_1}}
- Image image = container.Content.AddImage();
- Image imageWithSource = container.Content.AddImage(imageSource);
-{{endregion}}
+
>tipThere are other methods that allow adding an image to a document by passing image size, format and source. They could be used through the [FixedContentEditor class]({%slug radpdfprocessing-editing-fixedcontenteditor%}).
@@ -77,10 +56,7 @@ The Image class exposes also the **GetBitmapSource()** method, enabling you to o
#### __[C#] Example 3: Obtain BitmapSource__
-{{region cs-radpdfprocessing-model-image_2}}
-
- BitmapSource source = image.GetBitmapSource();
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/imagesource.md b/libraries/radpdfprocessing/model/imagesource.md
index bb246384..8f63998e 100644
--- a/libraries/radpdfprocessing/model/imagesource.md
+++ b/libraries/radpdfprocessing/model/imagesource.md
@@ -31,12 +31,7 @@ __Example 1__ illustrates how you can create an ImageSource using a __FileStream
#### __[C#] Example 1: Create ImageSource from Stream__
-{{region cs-radpdfprocessing-model-imagesource_0}}
- using (FileStream source = File.Open(filename, FileMode.Open))
- {
- ImageSource imageSource = new ImageSource(source);
- }
-{{endregion}}
+
With the __EncodedImageData__ class you can create an __ImageSource__ with encoded image data. This way the image quality will not be reduced on import.
@@ -44,18 +39,12 @@ With the __EncodedImageData__ class you can create an __ImageSource__ with encod
__Example 2__ demonstrates how you can create an __ImageSource__ using the __EncodedImageData__ class.
#### __[C#] Example 2: Create ImageSource from EncodedImageData__
-{{region cs-radpdfprocessing-model-imagesource_1}}
- EncodedImageData imageData = new EncodedImageData(imageBytes, 8, 655, 983, ColorSpaceNames.DeviceRgb, new string[] { PdfFilterNames.DCTDecode });
- ImageSource imageSource = new ImageSource(imageData);
-{{endregion}}
+
With the __EncodedImageData__ class you can also create an __ImageSource__ with encoded image data and set its transparency. The __EncodedImageData__ class provides a second constructor overload where you can set the alpha-channel bytes of the image as a second constructor parameter in order to apply transparency to this image.
#### __[C#] Example 3: Create ImageSource from EncodedImageData with transparency__
-{{region cs-radpdfprocessing-model-imagesource_2}}
- EncodedImageData imageData = new EncodedImageData(imageBytes, alphaChannelBytes, 8, imageWidth, imageHeight, ColorSpaceNames.DeviceRgb, new string[] { PdfFilterNames.FlateDecode });
- ImageSource imageSource = new ImageSource(imageData);
-{{endregion}}
+
## Properties
@@ -83,16 +72,7 @@ __RadPdfProcessing__ exposes an extension method allowing you to convert every B
#### __[C#] Example 4: Create ImageSource with extension method__
-{{region cs-radpdfprocessing-model-imagesource_3}}
- BitmapImage bitmap = new BitmapImage();
- bitmap.BeginInit();
- bitmap.UriSource = new Uri(filename, UriKind.RelativeOrAbsolute);
- bitmap.EndInit();
-
- ImageSource imageSource = bitmap.ToImageSource();
-
- return imageSource;
-{{endregion}}
+
>The code from __Example 4__ won't compile in Silverlight due to differences in the BitmapImage API for this platform. You could pass the image as a stream to the SetSource() method of BitmapImage instead.
diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/checkboxfield.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/checkboxfield.md
index beaa418a..693cfdeb 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/checkboxfield.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/checkboxfield.md
@@ -35,17 +35,7 @@ CheckBoxField provides the following properties:
* **ExportValue**: Gets or sets the value of the field when exporting the interactive form. The default export value is “Yes”.
#### **[C#] Example 1: Create a CheckBoxField and add it to a page**
-{{region radpdfprocessing-model-interactive-forms-form-fields-checkboxfield_0}}
- CheckBoxField checkBoxField = new CheckBoxField("SampleCheckBox");
- checkBoxField.IsChecked = true;
-
- TwoStatesButtonWidget widget = checkBoxField.Widgets.AddWidget();
- widget.Rect = new Rect(100, 100, 20, 20);
- widget.RecalculateContent();
-
- document.AcroForm.FormFields.Add(checkBoxField);
- document.Pages[0].Annotations.Add(widget);
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/comboboxfield.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/comboboxfield.md
index 9e833e68..44ace225 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/comboboxfield.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/comboboxfield.md
@@ -40,23 +40,7 @@ ComboBoxField provides the following properties:
* **ShouldSpellCheck**: Boolean value indicating whether the text should be spell checked during its input.
#### **[C#] Example 1: Create a ComboBoxField and add it to a page**
-{{region radpdfprocessing-model-interactive-forms-form-fields-comboboxfield_0}}
-
- ComboBoxField comboBoxField = new ComboBoxField("SampleComboBox");
-
- comboBoxField.Options.Add(new ChoiceOption("First Value"));
- comboBoxField.Options.Add(new ChoiceOption("Second Value"));
- comboBoxField.Options.Add(new ChoiceOption("Third Value"));
-
- comboBoxField.Value = comboBoxField.Options[1];
-
- VariableContentWidget widget = comboBoxField.Widgets.AddWidget();
- widget.Rect = new Rect(100, 100, 200, 30);
- widget.RecalculateContent();
-
- document.AcroForm.FormFields.Add(comboBoxField);
- document.Pages[0].Annotations.Add(widget);
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/combtextboxfield.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/combtextboxfield.md
index a75d49ff..6e8f4052 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/combtextboxfield.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/combtextboxfield.md
@@ -32,23 +32,7 @@ CombTextBoxField provides the following properties:
* **MaxLengthOfInputCharacters**: Integer value specifying the number of characters that can be inputted.
#### **[C#] Example 1: Create a CombTextBoxField and add it to a page**
-{{region radpdfprocessing-model-interactive-forms-form-fields-combtextboxfield_0}}
-
- CombTextBoxField combTextBoxField = new CombTextBoxField("SampleCombTextBox")
- {
- MaxLengthOfInputCharacters = 4,
- DefaultValue = "2017",
- Value = "2017",
- };
-
- VariableContentWidget widget = combTextBoxField.Widgets.AddWidget();
- widget.Rect = new Rect(new Size(250, 50));
- widget.RecalculateContent();
-
- document.AcroForm.FormFields.Add(combTextBoxField);
- document.Pages[0].Annotations.Add(widget);
-
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/formfields.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/formfields.md
index 9499db11..23a12ad0 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/formfields.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/formfields.md
@@ -37,32 +37,7 @@ Each field type can be recognized from the FormField base class by getting the v
#### **[C#] Example 1: Obtain fields from a document**
-{{region radpdfprocessing-model-interactive-forms-form-fields_0}}
-
- using (Stream stream = FileHelper.GetSampleResourceStream("InteractiveForms.pdf"))
- {
- RadFixedDocument document = new PdfFormatProvider().Import(stream, TimeSpan.FromSeconds(10));
- foreach (FormField field in document.AcroForm.FormFields)
- {
- switch (field.FieldType)
- {
- case FormFieldType.TextBox:
- this.ProcessTextBox((TextBoxField)field);
- break;
- case FormFieldType.ListBox:
- this.ProcessListBox((ListBoxField)field);
- break;
- case FormFieldType.RadioButton:
- this.ProcessRadioButtons((RadioButtonField)field);
-
- break;
- case FormFieldType.CheckBox:
- this.ProcessCheckBoxes((CheckBoxField)field);
- break;
- }
- }
- }
-{{endregion}}
+
The following list shows all the inheritors of the FormField class:
@@ -89,13 +64,7 @@ In R2 2020 we introduced the __Rename__ method which allows you to rename the Fo
#### **[C#] Example 2: Rename Form Fields**
-{{region radpdfprocessing-model-interactive-forms-form-fields_1}}
-
- public void RenameFields(RadFixedDocument document)
- {
- document.AcroForm.FormFields.Rename("OldName", "NewName");
- }
-{{endregion}}
+
## Merging Documents with Form Fields
@@ -103,34 +72,7 @@ When merging documents that contain FormFields, you need to ensure that each fie
#### **[C#] Example 2: Merge files with Form Fields**
-{{region radpdfprocessing-model-interactive-forms-form-fields_2}}
-
- public void MergeFields()
- {
- PdfFormatProvider provider = new PdfFormatProvider();
- var document = provider.Import(File.ReadAllBytes(@"D:\FormFieldDoc.pdf"), TimeSpan.FromSeconds(10));
- var document1 = provider.Import(File.ReadAllBytes(@"D:\FormFieldDoc1.pdf"), TimeSpan.FromSeconds(10));
-
- document.MergedFieldNameResolving += Document_MergedFieldNameResolving;
-
- document.Merge(document1);
-
- using (FileStream fs = new FileStream(@"MergedResult.pdf", FileMode.OpenOrCreate))
- {
- provider.Export(document, fs);
- }
-
- }
-
- private void Document_MergedFieldNameResolving(object sender, MergedFormFieldNameResolvingEventArgs e)
- {
- if (e.UsedNames.Contains(e.Name))
- {
- e.NewName = e.Name + "1";
- }
- }
-
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/listboxfield.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/listboxfield.md
index 0f41cd3e..4285ebcb 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/listboxfield.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/listboxfield.md
@@ -38,23 +38,7 @@ ListBoxField provides the following properties:
#### **[C#] Example 1: Create a ListBoxField and add it to a page**
-{{region radpdfprocessing-model-interactive-forms-form-fields-listboxfield_0}}
-
- ListBoxField listBoxField = new ListBoxField("SampleListBox");
-
- listBoxField.Options.Add(new ChoiceOption("First Value"));
- listBoxField.Options.Add(new ChoiceOption("Second Value"));
- listBoxField.Options.Add(new ChoiceOption("Third Value"));
-
- listBoxField.Value = new ChoiceOption[] { listBoxField.Options[1] };
-
- VariableContentWidget widget = listBoxField.Widgets.AddWidget();
- widget.Rect = new Rect(100, 100, 200, 200);
- widget.RecalculateContent();
-
- document.AcroForm.FormFields.Add(listBoxField);
- document.Pages[0].Annotations.Add(widget);
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/pushbuttonfield.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/pushbuttonfield.md
index 293d4a84..a0234a11 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/pushbuttonfield.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/pushbuttonfield.md
@@ -25,25 +25,7 @@ PushButtonField provides a single property called **Widgets**. It represents the
#### **[C#] Example 1: Create a PushButtonField and add it to a page**
-{{region radpdfprocessing-model-interactive-forms-form-fields-pushbuttonfield_0}}
-
- PushButtonField pushButtonField = new PushButtonField("SamplePushButton");
-
- PushButtonWidget widget = pushButtonField.Widgets.AddWidget();
- widget.Rect = new Rect(new Size(250, 50));
- widget.HighlightingMode = HighlightingMode.InvertBorderOfAnnotationRectangle;
-
- widget.AppearanceCharacteristics.Background = new RgbColor(123, 165, 134);
- widget.AppearanceCharacteristics.NormalCaption = "Click here";
-
- widget.TextProperties.FontSize = 20;
- widget.TextProperties.Font = FontsRepository.Courier;
- widget.TextProperties.Fill = new RgbColor(0, 0, 0);
- widget.RecalculateContent();
-
- document.AcroForm.FormFields.Add(pushButtonField);
- document.Pages[0].Annotations.Add(widget);
-{{endregion}}
+
>important In **.NET Standard/.NET (Target OS: None)** environments, fonts beyond the [14 standard ones]({%slug radpdfprocessing-concepts-fonts%}#standard-fonts) require a [FontsProvider implementation]({%slug pdfprocessing-implement-fontsprovider%}) to be resolved correctly.
diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/radiobuttonfield.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/radiobuttonfield.md
index 8f750db0..d082c67a 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/radiobuttonfield.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/radiobuttonfield.md
@@ -39,21 +39,7 @@ RadioButtonField provides the following properties:
#### **[C#] Example 1: Create RadioButtonFields and add them to a page**
-{{region radpdfprocessing-model-interactive-forms-form-fields-radiobuttonfield_0}}
- RadioButtonField radioButtonField = new RadioButtonField("SampleRadioButton");
-
- radioButtonField.Widgets.AddWidget(new RadioOption("True")).Rect = new Rect(0, 0, 20, 20);
- radioButtonField.Widgets.AddWidget(new RadioOption("False")).Rect = new Rect(25, 0, 20, 20);
- radioButtonField.Widgets.AddWidget(new RadioOption("False")).Rect = new Rect(50, 0, 20, 20);
-
- document.AcroForm.FormFields.Add(radioButtonField);
-
- foreach (RadioButtonWidget widget in radioButtonField.Widgets)
- {
- document.Pages[0].Annotations.Add(widget);
- widget.RecalculateContent();
- }
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/signaturefield.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/signaturefield.md
index ca267d62..f2e89f7b 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/signaturefield.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/signaturefield.md
@@ -35,31 +35,7 @@ SignatureField provides the following properties:
#### **[C#] Example 1: Create a SignatureField and add it to a page**
-{{region radpdfprocessing-model-interactive-forms-form-fields-signaturefield_0}}
-
- SignatureField signatureField = new SignatureField("SampleSignature");
- signatureField.Signature = new Signature(certificate); // The Signature property fo SignatureField is not available in PdfProcessing for .NET Standard.
-
- SignatureWidget widget = signatureField.Widgets.AddWidget();
- widget.Rect = new Rect(new Point(200, 600), new Size(100, 100));
- widget.Border = new AnnotationBorder(5, AnnotationBorderStyle.Solid, null);
-
- // Create a Form object to define the appearance you would like for the signature field.
- Form form = new Form();
- form.FormSource = new FormSource();
- form.FormSource.Size = new Size(120, 120);
-
- FixedContentEditor formEditor = new FixedContentEditor(form.FormSource);
- formEditor.DrawCircle(new Point(50, 50), 20);
- formEditor.DrawText("Sample Signature");
-
- // Add the FormSource object to the widget of the field.
- widget.Content.NormalContentSource = form.FormSource;
-
- RadFixedPage page = document.Pages.Last();
- page.Annotations.Add(widget);
- document.AcroForm.FormFields.Add(signatureField);
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/textboxfield.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/textboxfield.md
index a4e3be9d..2d87d582 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/textboxfield.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/textboxfield.md
@@ -42,44 +42,7 @@ TextBoxField exposes the following properties:
* **MaxLengthOfInputCharacters**: Nullable integer value specifying the maximal length of the inputted text. When null, the text is not restricted to any specified length.
#### **[C#] Example 1: Create a TextBoxField and add it to a page**
-{{region radpdfprocessing-model-interactive-forms-form-fields-textboxfield_0}}
-
- using Telerik.Windows.Documents.Fixed.Model.Annotations;
- using Telerik.Windows.Documents.Fixed.Model.InteractiveForms;
- using Telerik.Windows.Documents.Fixed.Model;
- using System.Windows;
-
- namespace ConsoleNetFramework
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- RadFixedDocument fixedDocument = new RadFixedDocument();
- fixedDocument.Pages.AddPage();
-
- TextBoxField textField = new TextBoxField("SampleTextBox")
- {
- MaxLengthOfInputCharacters = 500,
- IsMultiline = true,
- IsPassword = false,
- IsFileSelect = false,
- ShouldSpellCheck = true,
- AllowScroll = true,
- Value = "Sample content",
- };
-
- VariableContentWidget widget = textField.Widgets.AddWidget();
- widget.Rect = new Rect(new Size(250, 50));
- widget.RecalculateContent();
-
- fixedDocument.AcroForm.FormFields.Add(textField);
- fixedDocument.Pages[0].Annotations.Add(widget);
- }
- }
- }
-
-{{endregion}}
+
>important In .NET Standard use __Telerik.Documents.Primitives.Rect__ instead of __System.Windows.Rect__.
diff --git a/libraries/radpdfprocessing/model/interactive-forms/formfieldcollection.md b/libraries/radpdfprocessing/model/interactive-forms/formfieldcollection.md
index 78e7b5c7..f03db426 100644
--- a/libraries/radpdfprocessing/model/interactive-forms/formfieldcollection.md
+++ b/libraries/radpdfprocessing/model/interactive-forms/formfieldcollection.md
@@ -39,12 +39,7 @@ There are methods allowing you to easily construct a form field and add it to th
**Example 1** shows how you can use the listed above methods to generate a form field and add it to the collection.
#### **[C#] Example 1: Creating a form field**
-{{region radpdfprocessing-model-interactive-forms-formfieldcollection_0}}
-
- CombTextBoxField comb = document.AcroForm.FormFields.AddCombTextBox("comb");
- comb.MaxLengthOfInputCharacters = 10;
- comb.Value = "0123456789";
-{{endregion}}
+
You can also use several more methods of the class to modify the collection of form fields in the document's [AcroForm]({%slug radpdfprocessing-model-interactive-forms-acroform %}).
@@ -56,13 +51,7 @@ You can also use several more methods of the class to modify the collection of f
* **Contains()**: Accepts a string representing the form field name. Returns *true* when a field with such a name is present in the collection, otherwise *false*.
#### **[C#] Example 2: Using the methods of FormFieldCollection**
-{{region radpdfprocessing-model-interactive-forms-formfieldcollection_1}}
-
- if (document.AcroForm.FormFields.Contains(fieldName))
- {
- document.AcroForm.FormFields.Remove(document.AcroForm.FormFields[fieldName]);
- }
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/named-destinations.md b/libraries/radpdfprocessing/model/named-destinations.md
index 51df8439..40786789 100644
--- a/libraries/radpdfprocessing/model/named-destinations.md
+++ b/libraries/radpdfprocessing/model/named-destinations.md
@@ -34,10 +34,7 @@ The **NamedDestinations** collection is exposed by RadFixedDocument and is used
#### __[C#] Example 1: Create NamedDestination with Destination of type Link__
-{{region cs-radpdfprocessing-model-named-destinations_0}}
-
- this.pdfDocument.NamedDestinations.Add("myNamedDest", new Location() { Page = this.pdfDocument.Pages[0], Left = 50, Top = 150 });
-{{endregion}}
+
## Remove
@@ -45,21 +42,15 @@ You can remove a named destination as you would do with any item in a collection
#### __[C#] Example 2: Remove NamedDestination__
-{{region cs-radpdfprocessing-model-named-destinations_1}}
-
- this.pdfDocument.NamedDestinations.Remove("myNamedDest");
-{{endregion}}
+
## Rename
In addition to the **Name** property of the **NamedDestination** class which provides you with a setter, you can use the **Rename()** method of the **RadFixedDocument.NamedDestinations** collection.
-#### __[C#] Example 3: Remove NamedDestination__
+#### __[C#] Example 3: Rename NamedDestination__
-{{region cs-radpdfprocessing-model-named-destinations_2}}
-
- this.pdfDocument.NamedDestinations.Rename("myNamedDest", "Chapter1");
-{{endregion}}
+
## Check If a Name Exists
@@ -67,10 +58,7 @@ The **NamedDestinations** collection provides you with the ContainsName() method
#### __[C#] Example 4: Check if a NamedDestination already exists__
-{{region cs-radpdfprocessing-model-named-destinations_3}}
-
- this.pdfDocument.NamedDestinations.ContainsName("myNamedDest");
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/path.md b/libraries/radpdfprocessing/model/path.md
index 396ae695..3c8bcd65 100644
--- a/libraries/radpdfprocessing/model/path.md
+++ b/libraries/radpdfprocessing/model/path.md
@@ -51,21 +51,14 @@ __Example 1__ shows how you can create a Path, assign a predefined Geometry to i
#### __[C#] Example 1: Create Path and add it to container__
-{{region cs-radpdfprocessing-model-path_0}}
- Path path = new Path();
- path.Geometry = geometry;
- container.Content.Add(path);
-{{endregion}}
+
__Example 2__ demonstrates how to use one of the factory methods of the __ContentElementCollection__ that create a new path and insert it into the document.
#### __[C#] Example 2: Add Path to container__
-{{region cs-radpdfprocessing-model-path_1}}
- Path path = container.Content.AddPath();
- path.Geometry = geometry;
-{{endregion}}
+
>There are other methods that allow adding a path to a document. They could be used through the [FixedContentEditor class]({%slug radpdfprocessing-editing-fixedcontenteditor%}).
@@ -77,36 +70,7 @@ You can modify a __Path__ element using the properties the class exposes. The pr
#### __[C#] Example 3: Modifying Path properties__
-{{region cs-radpdfprocessing-model-path_2}}
- RadFixedDocument document = new RadFixedDocument();
- RadFixedPage page = document.Pages.AddPage();
- FixedContentEditor editor = new FixedContentEditor(page);
-
- RectangleGeometry rectangleGeometry = new RectangleGeometry();
- rectangleGeometry.Rect = new Rect(10, 5, 400, 300);
-
- Telerik.Windows.Documents.Fixed.Model.Graphics.Path path = new Telerik.Windows.Documents.Fixed.Model.Graphics.Path();
- path.Geometry = rectangleGeometry;
-
- SimplePosition simplePosition = new SimplePosition();
- simplePosition.Translate(20, 20);
-
- path.Fill = new RgbColor(255, 0, 255);
- path.Stroke = new RgbColor(0, 0, 255);
- path.IsFilled = true;
- path.IsStroked = true;
- path.StrokeThickness = 1;
- path.StrokeLineCap = Telerik.Windows.Documents.Fixed.Model.Graphics.LineCap.Flat;
- path.StrokeLineJoin = Telerik.Windows.Documents.Fixed.Model.Graphics.LineJoin.Round;
- path.StrokeDashArray = new double[] { 1 };
- path.StrokeDashOffset = 2;
- path.AlphaConstant = 0.5;
- path.StrokeAlphaConstant = 0.1;
- path.MiterLimit = 2;
- path.Position = simplePosition;
-
- page.Content.Add(path);
-{{endregion}}
+
## See Also
diff --git a/libraries/radpdfprocessing/model/radfixeddocument.md b/libraries/radpdfprocessing/model/radfixeddocument.md
index e03460f1..2d818d94 100644
--- a/libraries/radpdfprocessing/model/radfixeddocument.md
+++ b/libraries/radpdfprocessing/model/radfixeddocument.md
@@ -62,9 +62,7 @@ __Example 1__ shows how you can create a new __RadFixedDocument__ instance.
#### __[C#] Example 1: Create RadFixedDocument__
-{{region cs-radpdfprocessing-model-radfixeddocument_0}}
- RadFixedDocument document = new RadFixedDocument();
-{{endregion}}
+
## Operating with RadFixedDocument
@@ -74,9 +72,7 @@ __Example 2__ adds a page to the document created in [__Example 1__](#example1).
#### __[C#] Example 2: Add page to RadFixedDocument__
-{{region cs-radpdfprocessing-model-radfixeddocument_1}}
- RadFixedPage page = document.Pages.AddPage();
-{{endregion}}
+
Alternatively, you can create new __RadFixedPage__ and add it to the __Pages__ collection of a document.
@@ -86,27 +82,20 @@ __Example 3__ creates a page and adds it to the document created in [__Example 1
#### __[C#] Example 3: Create and add a page to RadFixedDocument__
-{{region cs-radpdfprocessing-model-radfixeddocument_2}}
- RadFixedPage page = new RadFixedPage();
- document.Pages.Add(page);
-{{endregion}}
+
**Example 4** shows you how you could obtain a copy of a RadFixedDocument.
#### __[C#] Example 4: Clone a document__
-{{region cs-radpdfprocessing-model-radfixeddocument_5}}
- RadFixedDocument clonedDocument = document.Clone();
-{{endregion}}
+
You can merge PDF documents out-of-the-box with the Merge() method of __RadFixedDocument__. This method clones the source document and appends it to the current instance of __RadFixedDocument__.
#### __[C#] Example 5: Merge documents__
-{{region cs-radpdfprocessing-model-radfixeddocument_4}}
- document.Merge(source);
-{{endregion}}
+
The code from __Example 5__ merges the document created in [__Example 1__](#example1) with another __RadFixedDocument__.
diff --git a/libraries/radpdfprocessing/model/radfixedpage.md b/libraries/radpdfprocessing/model/radfixedpage.md
index 5519c1ba..2b85ab63 100644
--- a/libraries/radpdfprocessing/model/radfixedpage.md
+++ b/libraries/radpdfprocessing/model/radfixedpage.md
@@ -37,11 +37,7 @@ __Example 1__ demonstrates how to create a new __RadFixedPage__ instance and add
#### __[C#] Example 1: Create RadFixedPage and add it to a document__
-{{region cs-radpdfprocessing-model-radfixedpage_0}}
- RadFixedDocument document = new RadFixedDocument();
- RadFixedPage page = new RadFixedPage();
- document.Pages.Add(page);
-{{endregion}}
+
## Operating with RadFixedPage
@@ -55,10 +51,7 @@ __Example 2__ shows how to add a previously created ContentElement in a __RadFix
#### __[C#] Example 2: Add content element to RadFixedPage__
-{{region cs-radpdfprocessing-model-radfixedpage_1}}
- RadFixedPage page = new RadFixedPage();
- page.Content.Add(contentElement);
-{{endregion}}
+
You can also use the __Add\[Element]()__ methods of RadFixedPages's __Content__ property. The respective methods - AddPath(), AddTextFragment(), AddImage(), create the element, add it to the page and return it for your convenience.
@@ -71,10 +64,7 @@ __Example 3__ shows how to add a previously created annotation in a __RadFixedPa
#### __[C#] Example 3: Add annotation to RadFixedPage__
-{{region cs-radpdfprocessing-model-radfixedpage_2}}
- RadFixedPage page = new RadFixedPage();
- page.Annotations.Add(annotation);
-{{endregion}}
+
The other possible approach is using the __AddLink()__ method of the __Annotations__ property. The method creates the link, adds it to the page and returns it. More information on the topic is available in the [Annotation]({%slug radpdfprocessing-model-annotations-links%}) article.
@@ -87,11 +77,7 @@ __Example 4__ shows how you can change the __Rotation__ and __Size__ properties
#### __[C#] Example 4: Change properties of a RadFixedPage__
-{{region cs-radpdfprocessing-model-radfixedpage_3}}
- RadFixedPage page = new RadFixedPage();
- page.Rotation = Rotation.Rotate270;
- page.Size = new Size(792, 1128);
-{{endregion}}
+
>note A complete SDK example how to generate a document is available [here](https://github.com/telerik/document-processing-sdk/tree/master/PdfProcessing/GenerateDocument).