What's New in TX Text Control .NET for Windows Forms 31.0
Signature fields, which mark where a document is signed, arrived in TX Text Control .NET for Windows Forms with version 31.0. So did NuGet packages and full Visual Studio designer support for .NET 5, .NET 6 and .NET 7, which made the version the first to support modern .NET the way the .NET Framework had been. Developers who maintain an application on 31.0, or who plan a step up from it, get its additions over version 30.0 in full, down to the events a handler can react to.
Version 31.0 was released on September 7, 2022, together with TX Text Control .NET Server, TX Text Control .NET for WPF, TX Text Control ActiveX and TX Spell .NET 10.0. The current version is Version 34.0. The service packs of 31.0 are listed on Service Packs.
Version 31.0 at a Glance
| Area | What is new |
|---|---|
| Signatures | Signature fields that hold a signature image and can be signed with a certificate in PDF documents |
| Dialog boxes | A Save As dialog box with options, a form field dialog box and a signature field layout dialog box |
| Mail merge | Cultures for parsing the data and formatting the result, merge settings for DataSourceManager |
| .NET | .NET 5, .NET 6 and .NET 7, NuGet packages, the Visual Studio designer for .NET |
Signature Fields
A signature field is a frame in the document that holds the image of a signature, added when the document is designed or later, when it is signed. In a PDF document, a named signature field can be associated with a digital certificate.
- Classes. SignatureField derives from
FrameBase, like images and text frames, and is positioned like them. SignatureFieldCollection, returned by TextControl.SignatureFields and ServerTextControl.SignatureFields, contains the fields of a document; one overload of itsAddmethod lets the user draw the field with the mouse. SignerData holds the expected signer and the reason for signing. - Signature images. SignatureImage is the image of a field. Its export properties decide how the image is written when the document is saved: ExportFilterIndex the format, ExportFileName the file name, ExportCompressionQuality the quality of a lossy compression from 1 to 100 and ExportMaxResolution the maximum resolution in dpi. SaveMode decides whether the image is saved with its data or as a file reference.
- Certificates. When you save a PDF or PDF/A document, SaveSettings.SignatureFields takes an array of DigitalSignature objects, each associating an X.509 certificate with the signature field of the same name.
- Events and dialog box.
TextControlraises five events when a signature field is created, deleted, clicked, selected or deselected.SignatureFieldCreatedoccurs when a field is inserted from the clipboard or loaded with a document, not when your code callsAdd.ServerTextControlraisesSignatureFieldCreatedandSignatureFieldDeleted, and itsSignatureFieldDeletedalso occurs whenRemovedeletes a field. TextControl.SignatureFieldLayoutDialog opens a dialog box for the layout of the selected field, which also offers the options for saving its image. Signature Fields shows how to insert signature fields, set their images and handle their events, and Digitally Sign a PDF signs a field with a certificate. The blog article Sneak Peek 31.0: Signature Fields shows the fields in the user interface.
Signature Fields in the User Interface
The insert tab of the ribbon, RibbonInsertTab, has a button that inserts a signature field, identified by TXITEM_InsertSignature of RibbonInsertTab.RibbonItem. The Frame Formatting tab, RibbonFrameLayoutTab, has a group in which users enter the signer, the title, the address, the contact information and the reason for signing. Its items are values of RibbonFrameLayoutTab.RibbonItem, such as TXITEM_SignerName, and the data is stored in the PDF document.
Built-In Dialog Boxes and Form Fields
- Save As options. A new overload of TextControl.Save opens the built-in Save As dialog box with additional options. Its last parameter takes one or more values of SaveSettings.DialogSettings:
EnterPasswordadds a button to set a password for a PDF document,StylesheetOptionslets the user save the CSS of an HTML document inline or in a separate file, andSaveSelectionadds a check box to save only the selected text. - Preselected format. LoadSaveSettingsBase.DefaultStreamType sets the format that the open and Save As dialog boxes preselect.
- Form field dialog box. FormField.FormFieldDialog opens a built-in dialog box for the attributes of a form field, such as its name, its ID and the items of a drop-down field.
- Form field changes. TextControl.FormFieldSettingsChanged occurs when the name, the ID or the formatting of a form field has changed. It passes a FormFieldEventArgs object with the form field.
Built-in Dialog Boxes lists the dialog boxes, and Form Fields and Conditional Instructions covers form fields.
Mail Merge Cultures
The number and date formats of the data can differ from the formats the merged document should show. Version 31.0 lets you set a culture for each side.
- Two cultures. MailMerge.DataSourceCulture is used to parse number and date values from the data source, and MailMerge.MergeCulture to format them in the result. Both default to the culture of the current thread.
- Cultures per field. MergeField, IfField and NextIfField have their own
DataSourceCultureandMergeCultureproperties. DateField.Culture is used to apply the format string of a date field. - Sorting and filtering. FilterInstruction.Culture and SortingInstruction.Culture are used to compare numbers when the rows of a merge block are filtered and sorted. They default to the invariant culture.
- UTC offset of date fields. MailMerge.DateFieldUtcOffset sets an offset from UTC in minutes for date fields.
Merge Fields in Getting Started merges data into a template.
DataSourceManager
DataSourceManager handles the data sources of a mail merge. In version 31.0, it received:
- the properties DataSourceCulture and MergeCulture
- MaxMergeResults, the maximum number of merge results
- the events DataRowMerged and FieldMerged
- the class MergeSettings, which passes additional settings to DataSourceManager.Merge: whether the results are merged into a single document, and whether empty blocks, fields, images and lines and trailing whitespace are removed
The About Panel and the Samples
Text Control revised the TX Text Control Words sample and split it into several samples, each showing one area such as the ribbon, the context menu, drag and drop, shortcuts, reporting or right-to-left text. Each sample shows a Sidebar whose ContentLayout is SidebarContentLayout.About: a panel with a TextControl for information about the application, reached through Sidebar.Content. Sidebar lists the panels of the sidebar.
.NET and Packages
- .NET versions. Version 31.0 supports .NET 5, .NET 6 and .NET 7, which was a preview at the time of the release, besides the .NET Framework. Text Control announced support for the final release of .NET 7 in November 2022; see the blog article .NET 7 Day 0 Support for all .NET Products of Text Control.
- The designer for .NET. Version 30.0 ran on .NET 5 and .NET 6, but without designer and toolbox support in Visual Studio. With version 31.0, you place a
TextControlon a form and connect the ribbon and the other bars to it in the Visual Studio 2022 designer, as in .NET Framework projects. See Visual Studio Toolbox and Designer. - Text Control Offline Packages. The setup adds a NuGet package source named Text Control Offline Packages that contains the NuGet packages of the Text Control components. The packages configure the references and the license automatically, add their controls to the toolbox and support the Publish command of Visual Studio. See Text Control Offline Packages.
- Licensing without BinaryFormatter. In version 30.0, compiling the license into a .NET assembly required the obsolete .NET
BinaryFormatterto be enabled. Version 31.0 no longer requires it.
The blog article Visual Studio 2022 and .NET 5, 6 and 7 (Preview) Support and Strategy explains the changes.
New Classes and Members
The What's New documentation of version 31.0 lists these classes, properties, methods and events as new in TX Text Control .NET for Windows Forms, grouped by class. Each name leads to its reference page.
- DocumentServer.DataShaping.FilterInstruction: Culture
- DocumentServer.DataShaping.SortingInstruction: Culture
- DocumentServer.DataSources.DataSourceManager: DataRowMerged, DataSourceCulture, FieldMerged, MaxMergeResults, MergeCulture
- DocumentServer.DataSources.MergeSettings (new class): AsSingleDocument, RemoveEmptyBlocks, RemoveEmptyFields, RemoveEmptyImages, RemoveEmptyLines, RemoveTrailingWhitespace
- DocumentServer.Fields.DateField: Culture
- DocumentServer.Fields.IfField: DataSourceCulture, MergeCulture
- DocumentServer.Fields.MergeField: DataSourceCulture, MergeCulture
- DocumentServer.Fields.NextIfField: DataSourceCulture, MergeCulture
- DocumentServer.MailMerge: DataSourceCulture, DateFieldUtcOffset, MergeCulture
- FormField: FormFieldDialog
- FormFieldEventArgs (new class): FormField
- LoadSaveSettingsBase (new class): DefaultStreamType, DocumentBasePath
- SaveSettings: SignatureFields
- ServerTextControl: OnSignatureFieldCreated, OnSignatureFieldDeleted, SignatureFieldCreated, SignatureFieldDeleted, SignatureFields
- SignatureField (new class): Image, SignerData
- SignatureFieldCollection (new class): Add, CopyTo, GetItem, Remove
- SignatureFieldEventArgs (new class): SignatureField
- SignatureImage (new class): ExportCompressionQuality, ExportFileName, ExportFilterIndex, ExportMaxResolution, FileName, FilterIndex, SaveMode
- SignerData (new class): Address, ContactInfo, Name, Reason, Title
- TextControl: FormFieldSettingsChanged, OnFormFieldSettingsChanged, OnSignatureFieldClicked, OnSignatureFieldCreated, OnSignatureFieldDeleted, OnSignatureFieldDeselected, OnSignatureFieldSelected, SignatureFieldClicked, SignatureFieldCreated, SignatureFieldDeleted, SignatureFieldDeselected, SignatureFieldLayoutDialog, SignatureFields, SignatureFieldSelected
Upgrade to Version 31.0
- No update notes. The What's New documentation of version 31.0 lists no changes to existing classes, properties, methods or events.
- Changes to plan for. None. Projects that reference the assemblies directly can move to the NuGet packages. Breaking Changes lists the changes of the other versions.
- Upgrade steps. Upgrading from Previous Versions and Migrating from .NET Framework to .NET cover the move of a project.
Next Steps
- Version 32.0: the features of the next version.
- Version 30.0: the features of the previous version.
- Digitally Sign a PDF: sign signature fields with a certificate.
- TX Text Control 31.0 and TX Spell .NET 10.0 Have Been Released: the release announcement on the Text Control Blog.