diff --git a/knowledge-base/images/quotedCsvValues.png b/knowledge-base/images/quoted-csv-values.png similarity index 100% rename from knowledge-base/images/quotedCsvValues.png rename to knowledge-base/images/quoted-csv-values.png diff --git a/knowledge-base/quote-worksheet-values-and-csv-export.md b/knowledge-base/quote-worksheet-values-and-csv-export.md index aea94a48..71945d20 100644 --- a/knowledge-base/quote-worksheet-values-and-csv-export.md +++ b/knowledge-base/quote-worksheet-values-and-csv-export.md @@ -64,7 +64,7 @@ using (StreamWriter writer = new StreamWriter(stream)) } } ``` - + ## See Also diff --git a/libraries/radpdfprocessing/concepts/fonts.md b/libraries/radpdfprocessing/concepts/fonts.md index 18cfb05f..9241d44c 100644 --- a/libraries/radpdfprocessing/concepts/fonts.md +++ b/libraries/radpdfprocessing/concepts/fonts.md @@ -77,8 +77,16 @@ There are 14 *Type 1* fonts, known as the standard 14 fonts, that are not embedd | Symbol| | 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. + ## Embedded Fonts All fonts, which are not included in the 14 standard ones, should be **embedded** in the PDF document. Otherwise, the result may be unpredictable when the document is rendered. In __RadPdfProcessing__ you have the ability to embed fonts following the approaches described below. @@ -93,7 +101,7 @@ __Example 1__ demonstrates how you can use the RegisterFont() method. #### __[C#] Example 1: Register font in .NET Framework application__ -{{region cs-radpdfprocessing-concepts-fonts_0}} +{{region cs-radpdfprocessing-concepts-fonts_1}} // Read the font file byte[] fontData = File.ReadAllBytes("some-font.ttf"); @@ -119,12 +127,20 @@ __Example 1__ demonstrates how you can use the RegisterFont() method. >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_1}} +{{region cs-radpdfprocessing-concepts-fonts_4}} FontBase font; bool success = FontsRepository.TryCreateFont(fontFamily, fontStyle, fontWeight, out font); {{endregion}} diff --git a/libraries/radpdfprocessing/editing/fixedcontenteditor.md b/libraries/radpdfprocessing/editing/fixedcontenteditor.md index cc78b359..55faa429 100644 --- a/libraries/radpdfprocessing/editing/fixedcontenteditor.md +++ b/libraries/radpdfprocessing/editing/fixedcontenteditor.md @@ -45,7 +45,10 @@ __FixedContentEditor__ is always associated with a single [RadFixedPage]({%slug #### __[C#] Example 1: Create FixedContentEditor__ {{region cs-radpdfprocessing-editing-fixedcontenteditor_0}} - FixedContentEditor editor = new FixedContentEditor(contentRootElement); + RadFixedDocument document = new RadFixedDocument(); + var firstPage = document.Pages.AddPage(); + + FixedContentEditor fixedContentEditor = new FixedContentEditor(firstPage); {{endregion}} The editor maintains an internal [Position]({%slug radpdfprocessing-concepts-position%}) inside the content root element. When a new element is created, its position is being set to the current position of the editor. The initial position of the editor can be specified when it is created. @@ -55,7 +58,16 @@ __Example 2__ demonstrates how you can create a FixedContentEditor with a specif #### __[C#] Example 2: Create FixedContentEditor with a specific position__ {{region cs-radpdfprocessing-editing-fixedcontenteditor_1}} - FixedContentEditor editor = new FixedContentEditor(contentRootElement, initialPosition); + MatrixPosition matrixPosition = new MatrixPosition(); + matrixPosition.Translate(20, 20); // Translates the position by (20, 20) + matrixPosition.Translate(30, 30); // Translates the position by (30, 30). + + 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. + + FixedContentEditor simplePositionfixedContentEditor = new FixedContentEditor(firstPage,matrixPosition); + FixedContentEditor matrixPositionfixedContentEditor = new FixedContentEditor(firstPage,matrixPosition); {{endregion}} ## Inserting Elements @@ -69,7 +81,7 @@ Inserting a [TextFragment]({%slug radpdfprocessing-model-textfragment%}) can be #### __[C#] Example 3: Insert TextFragment__ {{region cs-radpdfprocessing-editing-fixedcontenteditor_2}} - editor.DrawText("First text fragment."); + fixedContentEditor.DrawText("First text fragment."); {{endregion}} __Figure 1__ shows the result of __Example 3__. @@ -90,7 +102,7 @@ __Example 4__ shows how you can use the __Block__ object to draw a paragraph. Block block = new Block(); block.InsertText("First sentence."); block.InsertText("Second sentence."); - editor.DrawBlock(block); + fixedContentEditor.DrawBlock(block); {{endregion}} __Figure 2__ shows the result of __Example 4__. @@ -119,7 +131,7 @@ __Example 5__ shows how you can add an image created from a Stream. {{region cs-radpdfprocessing-editing-fixedcontenteditor_4}} using (Stream stream = this.GetResourceStream("Telerik_logo.jpg")) { - editor.DrawImage(stream, new Size(118, 28)); + fixedContentEditor.DrawImage(stream, new Size(118, 28)); } {{endregion}} @@ -141,7 +153,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}} - editor.DrawEllipse(new Point(250, 70), 136, 48); + fixedContentEditor.DrawEllipse(new Point(250, 70), 136, 48); {{endregion}} ### Inserting Clipping @@ -167,7 +179,7 @@ When a new clipping is pushed, it is set as a clipping to the current clipping i using (editor.PushClipping(new Rect(new Point(0, 0), visisibleTextSize))) { - editor.DrawText(text); + fixedContentEditor.DrawText(text); } {{endregion}} @@ -201,8 +213,8 @@ __Example 8__ generates a table and draws it in some fixed size. RadFixedDocument document = new RadFixedDocument(); RadFixedPage page = document.Pages.AddPage(); FixedContentEditor editor = new FixedContentEditor(page); - editor.Position.Translate(10, 10); - editor.DrawTable(table, new Size(180, double.PositiveInfinity)); + fixedContentEditor.Position.Translate(10, 10); + fixedContentEditor.DrawTable(table, new Size(180, double.PositiveInfinity)); {{endregion}} #### The table created in Example 8 @@ -217,7 +229,7 @@ With the FixedContentEditor class you can insert a Form (Form-XObject) element. #### __[C#] Example 9: Insert a form__ {{region cs-radpdfprocessing-editing-fixedcontenteditor_9}} - editor.DrawForm(formSource); + 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. @@ -238,8 +250,8 @@ The Widget annotations allow you visualize the content of a FormField. With the document.AcroForm.FormFields.Add(pushButton); - editor.Position.Translate(20, 450); - editor.DrawWidget(pushButton, new Size(100, 20)); + 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. @@ -256,12 +268,12 @@ The Widget annotations allow you visualize the content of a FormField. With the document.AcroForm.FormFields.Add(radio); - editor.Position.Translate(20, 410); - editor.DrawWidget(radio, radio.Options[0], new Size(20, 20)); - editor.Position.Translate(50, 410); - editor.DrawWidget(radio, radio.Options[1], new Size(20, 20)); - editor.Position.Translate(80, 410); - editor.DrawWidget(radio, radio.Options[2], new Size(20, 20)); + 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 @@ -273,13 +285,13 @@ 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}} - editor.Position.Scale(1.5, 0.5); - editor.Position.Rotate(10); - editor.DrawText("Image:"); - editor.Position.Translate(0, 20); + 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")) { - editor.DrawImage(stream, new Size(118, 28)); + fixedContentEditor.DrawImage(stream, new Size(118, 28)); } {{endregion}} diff --git a/libraries/radpdfprocessing/editing/radfixeddocumenteditor.md b/libraries/radpdfprocessing/editing/radfixeddocumenteditor.md index b117a620..790a0d1e 100644 --- a/libraries/radpdfprocessing/editing/radfixeddocumenteditor.md +++ b/libraries/radpdfprocessing/editing/radfixeddocumenteditor.md @@ -35,7 +35,12 @@ __Example 1__ demonstrates how a RadFixedDocumentEditor instance can be created. #### __[C#] Example 1: Create RadFixedDocumentEditor__ {{region cs-radpdfprocessing-editing-radfixeddocumenteditor_0}} - RadFixedDocumentEditor editor = new RadFixedDocumentEditor(radFixedDocument); + 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. @@ -61,6 +66,10 @@ The section properties are responsible for the page size, margins and orientatio * __Rotate180__: The page is rotated to 180°. * __Rotate270__: The page is rotated to 270°. +{{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 @@ -72,8 +81,8 @@ Adding an additional section is achieved with the __InsertSectionBreak()__ metho #### __[C#] Example 2: Start a section__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_1}} - editor.InsertSectionBreak(); +{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_2}} + radFixedDocumentEditor.InsertSectionBreak(); {{endregion}} @@ -84,8 +93,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 3: Start new page__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_2}} - editor.InsertPageBreak(); +{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_3}} + radFixedDocumentEditor.InsertPageBreak(); {{endregion}} ## Paragraphs @@ -120,6 +129,12 @@ Similar to the section properties, paragraph has its own properties that are res * __ListLevel__: The list level the paragraph belongs to. +{{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 @@ -131,12 +146,11 @@ In order to start a new paragraph, use the code in __Example 4__. #### __[C#] Example 4: Start a paragraph__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_3}} - editor.InsertParagraph(); +{{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. @@ -180,6 +194,15 @@ The character properties that are responsible for the look of the runs are liste * __StrikethroughColor__: The color of the strikethrough. +{{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. ### Inserting a Run @@ -188,9 +211,9 @@ There are a number of overloads that insert a run. The code snippet in __Example #### __[C#] Example 5: Insert run__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_4}} - editor.InsertRun("text"); - editor.InsertRun(fontFamily, "text"); +{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_7}} + radFixedDocumentEditor.InsertRun("text"); + radFixedDocumentEditor.InsertRun(new FontFamily("Helvetica"),"text"); {{endregion}} @@ -204,12 +227,11 @@ The code in __Example 6__ inserts a new run and a line break after it. #### __[C#] Example 6: Insert run and line break__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_5}} - editor.InsertLine("Line of text"); +{{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. @@ -221,9 +243,10 @@ You can insert image inline using one of the following methods: #### __[C#] Example 7: Insert image__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_6}} - editor.InsertImageInline(imageSource); - editor.InsertImageInline(imageSource, size); +{{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 @@ -233,8 +256,12 @@ The __Table__ class implements the __IBlockElement__ interface and an instance o #### __[C#] Example 8: Insert table__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_7}} - editor.InsertTable(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%}) documentation article. @@ -245,8 +272,11 @@ The [IBlockElement](https://docs.telerik.com/devtools/document-processing/api/Te #### __[C#] Example 9: Insert Block element__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_8}} - editor.InsertBlock(blockElement); +{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_11}} + Block block = new Block(); + block.InsertText("Text"); + + radFixedDocumentEditor.InsertBlock(block); {{endregion}} @@ -257,11 +287,11 @@ 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 10: Insert list__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_9}} - List list = editor.Lists.AddList(ListTemplateType.NumberedDefault); - editor.ParagraphProperties.ListId = list.Id; - editor.ParagraphProperties.ListLevel = 0; - editor.InsertParagraph(); +{{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%}). @@ -271,8 +301,8 @@ 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 11: Insert a form__ -{{region cs-radpdfprocessing-editing-radfixeddocumenteditor_10}} - editor.InsertFormInline(formSource); +{{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/features/digital-signature/overview.md b/libraries/radpdfprocessing/features/digital-signature/overview.md index c9ab2af1..9ddd0590 100644 --- a/libraries/radpdfprocessing/features/digital-signature/overview.md +++ b/libraries/radpdfprocessing/features/digital-signature/overview.md @@ -31,48 +31,69 @@ The following example shows a full code snippet for a simple signing of a newly {{region radpdfprocessing-features-digital-signature_2}} - 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( - new Point(signaturePositionLeft, signaturePositionTop), - new Size(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)) + 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 { - new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider().Export(document, output); + 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__. +  >important When signing an existing document (after the import) we must be sure the AcroForm's ViewersShouldRecalculateWidgetAppearances property is set to false, otherwise, the exported and signed PDF document could not be shown as a signed. 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 5571e849..8387423a 100644 --- a/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md +++ b/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md @@ -49,7 +49,7 @@ RadPdfProcessing provides support for embedding of [ZUGFeRD](https://de.wikipedi using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document)) { editor.CharacterProperties.TrySetFont(new System.Windows.Media.FontFamily("Calibri")); - editor.InsertRun("PDF/A-3B Complaint Invoice"); + editor.InsertRun("PDF/A-3B Compliant Invoice"); }; byte[] bytes = File.ReadAllBytes(@"zugferd-invoice.xml"); document.EmbeddedFiles.AddZugferdInvoice(bytes); diff --git a/libraries/radpdfprocessing/features/embedded-file-streams/embeddedfilescollection.md b/libraries/radpdfprocessing/features/embedded-file-streams/embeddedfilescollection.md index ef478f5c..de87b143 100644 --- a/libraries/radpdfprocessing/features/embedded-file-streams/embeddedfilescollection.md +++ b/libraries/radpdfprocessing/features/embedded-file-streams/embeddedfilescollection.md @@ -28,5 +28,5 @@ This class holds a collection of **EmbeddedFile** instances, assigned to the **E |**Add(string name, byte[] data)**|Adds a named embedded file with the specified name and value to the collection and returns it.| |**ContainsName(string name)**|Determines whether the collection contains the specified name.| |**Clear**|Removes all embedded files from the collection.| -|**AddZugferdInvoice(byte[] data)**|Adds an embedded ZUGFeRD complaint file to the collection and returns it. The Conformance level is set to Basic. *Only a single XML invoice attachment is allowed in ZUGFeRD.*| +|**AddZugferdInvoice(byte[] data)**|Adds an embedded ZUGFeRD compliant file to the collection and returns it. The Conformance level is set to Basic. *Only a single XML invoice attachment is allowed in ZUGFeRD.*| |**RemoveZugferdInvoice()**|Removes the embedded ZUGFeRD file with the specified name from the collection.| diff --git a/libraries/radpdfprocessing/model/interactive-forms/form-fields/textboxfield.md b/libraries/radpdfprocessing/model/interactive-forms/form-fields/textboxfield.md index e87c4bec..599ba40e 100644 --- a/libraries/radpdfprocessing/model/interactive-forms/form-fields/textboxfield.md +++ b/libraries/radpdfprocessing/model/interactive-forms/form-fields/textboxfield.md @@ -43,26 +43,46 @@ TextBoxField exposes the following properties: #### **[C#] Example 1: Create a TextBoxField and add it to a page** {{region radpdfprocessing-model-interactive-forms-form-fields-textboxfield_0}} - 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(); - document.AcroForm.FormFields.Add(textField); - document.Pages[0].Annotations.Add(widget); + 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__. + ## See Also * [Form Field]({%slug radpdfprocessing-model-interactive-forms-form-fields %}) diff --git a/libraries/radpdfprocessing/model/radfixeddocument.md b/libraries/radpdfprocessing/model/radfixeddocument.md index 3f2b7716..43d879d4 100644 --- a/libraries/radpdfprocessing/model/radfixeddocument.md +++ b/libraries/radpdfprocessing/model/radfixeddocument.md @@ -108,3 +108,5 @@ __RadFixedDocument__ exposes a __DocumentInfo__ property of type __RadFixedDocum * [Model]({%slug radpdfprocessing-model-general-information%}) * [RadFixedPage]({%slug radpdfprocessing-model-radfixedpage%}) * [Annotations]({%slug radpdfprocessing-model-annotations-overview%}) +* [Export to PDF]({%slug radpdfprocessing-formats-and-conversion-pdf-pdfformatprovider%}) +* [Export to Image]({%slug radpdfprocessing-formats-and-conversion-image-using-skiaimageformatprovider%}) \ No newline at end of file diff --git a/libraries/radspreadprocessing/features/setting-the-culture.md b/libraries/radspreadprocessing/features/setting-the-culture.md index 34fec2c3..b61901e8 100644 --- a/libraries/radspreadprocessing/features/setting-the-culture.md +++ b/libraries/radspreadprocessing/features/setting-the-culture.md @@ -15,7 +15,7 @@ __RadSpreadProcessing__ allows you to set a culture that differs from the curren {{region cs-radspreadprocessing-features-setting-the-culture_1}} - FormatHelper.CultureHelper = new SpreadsheetCultureHelper(new CultureInfo("en-US")); + Telerik.Windows.Documents.Spreadsheet.Formatting.FormatHelper.CultureHelper = new SpreadsheetCultureHelper(new CultureInfo("en-US")); {{endregion}} diff --git a/libraries/radspreadprocessing/features/shapes-and-images.md b/libraries/radspreadprocessing/features/shapes-and-images.md index b1bea0bf..3a69c7f6 100644 --- a/libraries/radspreadprocessing/features/shapes-and-images.md +++ b/libraries/radspreadprocessing/features/shapes-and-images.md @@ -94,11 +94,10 @@ In order to create an instance of __FloatingImage__ you need the worksheet in wh {{region cs-radspreadprocessing-features-shapes-and-images_0}} Worksheet worksheet = workbook.ActiveWorksheet; - FloatingImage image = new FloatingImage(worksheet, new CellIndex(7, 1), 35, 10); + Telerik.Windows.Documents.Spreadsheet.Model.Shapes.FloatingImage image = new Telerik.Windows.Documents.Spreadsheet.Model.Shapes.FloatingImage(worksheet, new CellIndex(7, 1), 35, 10); {{endregion}} - The next step is to configure the other properties of the image as needed. diff --git a/libraries/radspreadprocessing/formats-and-conversion/csv/csvformatprovider.md b/libraries/radspreadprocessing/formats-and-conversion/csv/csvformatprovider.md index fa9e922b..c12476a8 100644 --- a/libraries/radspreadprocessing/formats-and-conversion/csv/csvformatprovider.md +++ b/libraries/radspreadprocessing/formats-and-conversion/csv/csvformatprovider.md @@ -34,7 +34,7 @@ __Example 1__ shows how to import a CSV file using a __FileStream__. The code as } Workbook workbook; - IWorkbookFormatProvider formatProvider = new CsvFormatProvider(); + CsvFormatProvider formatProvider = new CsvFormatProvider(); using (Stream input = new FileStream(fileName, FileMode.Open)) { @@ -56,7 +56,7 @@ __Example 2__ demonstrates how to export an existing Workbook to a CSV file. The workbook.Worksheets.Add(); string fileName = "SampleFile.csv"; - IWorkbookFormatProvider formatProvider = new CsvFormatProvider(); + CsvFormatProvider formatProvider = new CsvFormatProvider(); using (Stream output = new FileStream(fileName, FileMode.Create)) { diff --git a/libraries/radwordsprocessing/concepts/fields/numbering-fields-provider.md b/libraries/radwordsprocessing/concepts/fields/numbering-fields-provider.md index be94b851..4053d92b 100644 --- a/libraries/radwordsprocessing/concepts/fields/numbering-fields-provider.md +++ b/libraries/radwordsprocessing/concepts/fields/numbering-fields-provider.md @@ -23,7 +23,7 @@ The default provider can be set with the following code: {{region cs-radwordsprocessing-concepts- numbering-fields-provider_1}} - FlowExtensibilityManager.NumberingFieldsProvider = new NumberingFieldsProvider(); + Telerik.Windows.Documents.Flow.Extensibility.FlowExtensibilityManager.NumberingFieldsProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.NumberingFieldsProvider(); {{endregion}} @@ -35,7 +35,7 @@ This method allows you to use a custom numbering style converter. {{region cs-radwordsprocessing-concepts- numbering-fields-provider_2}} - NumberingFieldsProvider numberingFieldsProvider = new NumberingFieldsProvider(); + Telerik.Windows.Documents.Flow.FormatProviders.Pdf.NumberingFieldsProvider numberingFieldsProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.NumberingFieldsProvider(); numberingFieldsProvider.RegisterNumberingStyleConverter(NumberingStyle.ChineseCounting, new NumberingStyleConverter()); diff --git a/libraries/radwordsprocessing/concepts/watermark.md b/libraries/radwordsprocessing/concepts/watermark.md index 1c82941e..58743328 100644 --- a/libraries/radwordsprocessing/concepts/watermark.md +++ b/libraries/radwordsprocessing/concepts/watermark.md @@ -72,7 +72,7 @@ Creating image watermark is very similar to creating a text one. __Example 2__ s Angle = 45, Width = 50, Height = 75, - ImageSource = new Telerik.Windows.Documents.Media.ImageSource(imageStream, "png") + ImageSource = new Telerik.Windows.Documents.Media.ImageSource(new FileStream("sample.jpeg", FileMode.Open), "jpeg") }); {{endregion}} diff --git a/libraries/radwordsprocessing/formats-and-conversion/pdf/features.md b/libraries/radwordsprocessing/formats-and-conversion/pdf/features.md index 6d18fd11..1ae1b7fd 100644 --- a/libraries/radwordsprocessing/formats-and-conversion/pdf/features.md +++ b/libraries/radwordsprocessing/formats-and-conversion/pdf/features.md @@ -256,7 +256,7 @@ Yes