What's New in TX Text Control .NET Server 31.0
Signature fields, which mark where a document is signed, and separate cultures for reading and formatting merge data are what version 31.0 added to TX Text Control .NET Server. 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 in September 2022, together with TX Text Control .NET for Windows Forms, TX Text Control .NET for WPF, TX Text Control ActiveX and TX Spell .NET 10.0. The current version is Version 34.0. The changes of the 31.0 service packs 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 |
| Mail merge | Cultures for parsing the data and formatting the result, merge settings for DataSourceManager |
| Document Editor | A customizable context menu, signature fields, built-in dialog boxes and appending documents in the JavaScript API |
| .NET | .NET 5, .NET 6 and .NET 7, NuGet packages in the Text Control Offline Packages source |
Signature Fields
A signature field is a frame in the document that holds the image of a signature, and in a PDF document a named signature field can be signed with a digital certificate. Version 31.0 adds signature fields to documents and to the API: ServerTextControl.SignatureFields returns the SignatureFieldCollection with a SignatureField object for each field, whose SignatureImage holds the image and whose SignerData describes the expected signer. SaveSettings.SignatureFields associates a certificate with each field when a PDF is saved. The export properties of SignatureImage, such as ExportFilterIndex and ExportMaxResolution, decide how the image is written when the document is saved, and the events SignatureFieldCreated and SignatureFieldDeleted of ServerTextControl report inserted and deleted fields. Signature Fields describes positions, images, signer data and file formats in detail.
When the Document Viewer shows a document, its signature fields become the places where users sign. Before 31.0, the viewer used a text frame with a specific name for this.
Digitally Sign a PDF shows the code that inserts a signature field and signs it with a certificate. The blog article Requesting Electronic Signatures using TX Text Control 31.0 shows the workflow from the Document Editor to the signed PDF.
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.
MailMerge.DataSourceCulture parses the number and date values of the data source, and MailMerge.MergeCulture formats them in the result. Both default to the culture of the current thread. The fields MergeField, IfField and NextIfField got their own DataSourceCulture and MergeCulture, and IfField and NextIfField compare numbers with the data source culture. DateField got a Culture for its format string, the sorting and filtering instructions of merge blocks a Culture that defaults to the invariant culture, and MailMerge a DateFieldUtcOffset in minutes, which uses the local date and time when it is null. Parse Numbers and Dates With the Right Culture shows the two MailMerge properties in code, Merge Fields the properties of the fields and Sorting and Filtering those of the instructions.
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
Document Editor
The Document Editor is the WYSIWYG word processor that you embed in your web application. Version 31.0 extends its JavaScript API.
- Customizable context menu. Before the editor shows a context menu, it raises the
contextMenuOpeningevent, which you attach with addEventListener. The handler receives ContextMenuEventArgs and can add, remove and change the menu items before the menu opens, or cancel the menu. Each ContextMenuItem has a text, an image, child items, a checked and an enabled state and a click handler. Thelocationproperty tells where the menu was opened, as a combination of ContextMenuLocation values such asTable,HeaderorMisspelledWord. See Context Menus. - Signature fields. Users insert signature fields with the Signature Field button on the Insert ribbon tab and enter the signer data on the Frame Formatting tab. In the JavaScript API, TXTextControl.signatureFields returns a SignatureFieldCollection with methods to add fields inline, anchored or at a fixed position. A SignatureImage object sets the export settings of the signature image with setExportCompressionQuality and setExportMaxResolution. The editor raises the events
signatureFieldCreated,signatureFieldDeleted,signatureFieldSelectedandsignatureFieldDeselected. - Built-in dialog boxes. showDialog opens a dialog box of the editor, such as the font, paragraph, table or table of contents dialog. The dialog boxes are the values of DialogBoxKind.
- Append documents. append adds a document to the end of the current one. A value of AppendSettings decides whether it starts in the last paragraph, a new paragraph or a new section.
- Form fields. setIsFormFieldValidationEnabled turns the validation of form fields on or off. FormField.setEnabled enables or disables a single form field. It takes effect in the
ReadAndSelectedit mode when the editing of form fields is allowed.
The blog article Sneak Peek 31.0: Customizing the Context Menu of the ASP.NET Document Editor shows the context menu event with examples.
Other API Additions
- TextViewGenerator events. ServerVisualization.TextViewGenerator, a
ServerTextControlthat shows its text as a generated image, has the new events FormFieldSettingsChanged, SignatureFieldSelected and SignatureFieldDeselected.FormFieldSettingsChangedpasses a FormFieldEventArgs object with the form field whose name, ID or formatting changed. - Load and save settings. The new abstract class LoadSaveSettingsBase is the base class of LoadSettings and SaveSettings. It provides DocumentBasePath, the base path saved in the document that resolves relative file paths, and the new DefaultStreamType, the file format that the Open and Save As dialog boxes preselect.
- Form field dialog box. FormField.FormFieldDialog opens a dialog box that changes the formatting attributes of a form field.
The What's New documentation of version 31.0 describes DefaultStreamType and FormFieldDialog together with the built-in dialog boxes of the Windows Forms and WPF TextControl.
.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, with NuGet packages for ASP.NET. Text Control announced support for the final release of .NET 7 in November 2022.
- 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. See Offline Packages.
- Licensing without BinaryFormatter. In version 30.0, compiling the license into an assembly required the obsolete .NET
BinaryFormatterto be enabled. Version 31.0 no longer requires it.
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 Server, grouped by class. Each name leads to its reference page.
.NET API
- 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
- ServerVisualization.TextViewGenerator: FormFieldSettingsChanged, OnFormFieldSettingsChanged, OnSignatureFieldDeselected, OnSignatureFieldSelected, SignatureFieldDeselected, SignatureFieldSelected
- 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
Document Editor JavaScript API
- ContextMenuEventArgs: cancel, items, location
- ContextMenuItem: clickHandler, dropDownIsScrollable, imageUrl, isChecked, isEnabled, items, text
- ContextMenuItemClickEventArgs: cancel, item
- FormField: getEnabled, setEnabled
- SignatureField: getSignerData, image, setImage, setSignerData
- SignatureFieldCollection: addAnchored, addAnchoredAtLocation, addAtFixedPositionInDocument, addAtFixedPositionOnPage, addInline, addWithMouse, getItem, getItemByName, remove
- SignatureFieldEventArgs: signatureField
- SignatureFieldInfo: image, signerData
- SignatureImage: getExportCompressionQuality, getExportMaxResolution, setExportCompressionQuality, setExportMaxResolution
- SignatureImageInfo: exportCompressionQuality, exportMaxResolution
- SignerData: address, contactInfo, name, reason, title
- TXTextControl: append, getIsFormFieldValidationEnabled, setIsFormFieldValidationEnabled, showDialog, signatureFields
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. Breaking Changes describes the .NET versions and the NuGet packages of 31.0.
- Upgrade steps. Migrating from Previous Versions describes how a project moves from assembly references to the NuGet packages.
Next Steps
- Version 32.0: the features of the next version.
- Version 30.0: the features of the previous version.
- Digitally Sign a PDF: insert signature fields and sign them with a certificate.
- Breaking Changes: the changes that can require work when you upgrade.