What's New in TX Text Control .NET for WPF 31.0
Signature fields, which mark where a document is signed, arrived in TX Text Control .NET for WPF with version 31.0. So did NuGet packages and licensing 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 Windows Forms, 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, licensing for .NET |
| Samples | TX Words split into individual samples, each explained in a sidebar |
Signature Fields
A signature field is a frame in the document that holds the image of a signature. You add the image when you design the document or later, when the document is signed. In a PDF document, a named signature field can also be associated with a digital certificate.
- Position. Like an image or a text frame, a signature field is positioned as a single character in the text or at a geometric position. A geometric position is relative to the paragraph the field is anchored to, to a page or to the whole document. One overload of SignatureFieldCollection.Add lets the user draw the field with the mouse.
- Signer data. SignatureField.SignerData stores data about the person who is expected to sign: name, title, address, contact information and the reason for signing.
- Certificates. When you save a PDF or PDF/A document, SaveSettings.SignatureFields takes an array of DigitalSignature objects. Each one associates an X.509 certificate with the signature field of the same name. A PDF document with unsigned signature fields can be signed in Acrobat Reader later.
- File formats. Signature fields are saved in the TX Text Control format, PDF, DOCX and RTF. All other formats save only the signature image.
The API and the User Interface
- Classes. SignatureField derives from
FrameBase, like images and text frames. TextControl.SignatureFields and ServerTextControl.SignatureFields hold the fields of a document, SignerData the expected signer and SignatureImage the image with its save options. - Events.
TextControlraises five events when a signature field is created, deleted, clicked, selected or deselected.ServerTextControlraises the first two. - Dialog box. TextControl.SignatureFieldLayoutDialog opens a built-in dialog box for the position, size and image saving options of the selected field.
- Ribbon. The Insert tab, RibbonInsertTab, has a button that inserts a signature field,
TXITEM_InsertSignature, and the Frame Formatting tab, RibbonFrameLayoutTab, a group in which users enter the signer data, with items such asTXITEM_SignerName.
Signature Fields shows how to insert signature fields in the ribbon and in code and how to handle their events, Signature Fields and Signature Appearance how to sign them and Digitally Sign a PDF takes you through a first signature. The blog article Sneak Peek 31.0: Signature Fields shows the fields in the user interface.
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
Samples
Version 31.0 revised the TX Words sample and split it into individual samples, which are easier to follow one at a time. Each sample shows a Sidebar at run time that explains the project. Its ContentLayout is About, a panel with a TextControl for the explanation, which TXITEM_AboutViewer of Sidebar.AboutItem identifies. TX Words describes the samples, and Sidebar 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.
- Licensing for .NET. The licensing of version 31.0 is compatible with .NET 5, .NET 6 and .NET 7, and the NuGet packages add the license to a project.
- 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 Configuring Package Sources.
- 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 WPF, grouped by class. Each name leads to its reference page. The On methods, such as OnSignatureFieldCreated, are protected methods that raise the event of the same name.
- 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
- WPF.TextControl: FormFieldSettingsChanged, OnFormFieldSettingsChanged, OnSignatureFieldClicked, OnSignatureFieldCreated, OnSignatureFieldDeleted, OnSignatureFieldDeselected, OnSignatureFieldSelected, SignatureFieldClicked, SignatureFieldCreated, SignatureFieldDeleted, SignatureFieldDeselected, SignatureFieldLayoutDialog, SignatureFields, SignatureFieldSelected
Upgrade to Version 31.0
The What's New documentation of version 31.0 lists no changes to existing classes, properties, methods or events, and the version has no change that requires work; projects that reference the assemblies directly can move to the NuGet packages. Breaking Changes names the versions that have changes, and 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.