With Text Control components and libraries, PDF documents can be created in all platforms including ASP.NET Core, Angular, React or pure JavaScript. This article focuses on the creation of PDF documents in .NET applications with C#.

In contrast to other PDF tools, TX Text Control can be used to create PDF documents from scratch or to prepare them from existing MS Word templates programmatically.

Viewing documents with TX Text Control

Creating PDFs From Scratch

TX Text Control libraries provide a powerful and complete API to create and manipulate documents programmatically. This API can be used in any .NET application including web and Windows applications.

The following code snippet shows how to create a new instance of ServerTextControl TX Text Control .NET for Windows Forms
TXTextControl Namespace
ServerTextControl Class
The ServerTextControl class implements a component that provide high-level text processing features for server-based applications.
, the non-visual Text Control class. The code inserts a paragraph, a table and exports the document as an Adobe PDF document:

Loading...

Use MS Word DOCX Templates

TX Text Control provides MS Word inspired document editor components for Angular, React and ASP.NET Core to modify and create templates. After a template has been designed, the reporting engine MailMerge TX Text Control .NET for Windows Forms
DocumentServer Namespace
MailMerge Class
The MailMerge class is a .NET component that can be used to effortlessly merge template documents with database content in .NET projects, such as ASP.NET web applications, web services or Windows services.
is used to populate merge fields with actual data from JSON or business objects. For each data row of the master table in the data source, a document is created. Merge fields are populated with column values and repeating blocks are merged with data rows of related child tables in the data source.

A data source can be any IEnumerable object (business objects), JSON objects, DataSet and DataTable objects.

The following code creates an instance of the reporting engine MailMerge to merge the template that is loaded into a ServerTextControl with an IEnumerable object. Finally, the document is exported as a PDF document:

Loading...

Apply PDF Settings

Using the SaveSettings TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
SaveSettings Class
The SaveSettings class provides properties for advanced settings and information during save operations.
class, you can define two passwords: the UserPassword to open the document and the MasterPassword for the document's access permissions. These permissions can be set using the DocumentAccessPermissions TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
LoadSettings Class
DocumentAccessPermissions Property
Specifies how a document can be accessed after it has been loaded.
property.

Possible values are:

AllowAll
After the document has been opened no further document access is restricted.

AllowAuthoring
Allows comments to be added and interactive form fields (including signature fields) to be filled in.

AllowAuthoringFields
Allows existing interactive form fields (including signature fields) to be filled in.

AllowContentAccessibility
Allows content access for the visually impaired only.

AllowDocumentAssembly
Allows the document to be to assembled (insert, rotate or delete pages and create bookmarks or thumbnails).

AllowExtractContents
Allows text and/or graphics to be extraced.

AllowGeneralEditing
Allows the document contents to be modified.

AllowHighLevelPrinting
Allows the document to be printed.

AllowLowLevelPrinting
Allows the document to be printed (low-level).

The following code shows how to set some of the above access permissions on saving a document:

Loading...

Adding Digital Signatures

TX Text Control can be used to create Adobe PDF and PDF/A documents with digital signatures. These signatures can be created with PFX, DER Cer or Base64 CER certificate files. All you need is a valid certificate that is defined in the TXTextControl.SaveSettings class TX Text Control .NET for Windows Forms
TXTextControl Namespace
SaveSettings Class
The SaveSettings class provides properties for advanced settings and information during save operations.
.

Loading...

Creating PDF/A - Embedded Documents

TX Text Control supports the embedding of attachments in PDF/A-3b documents and also the extraction of an attachment. The following code shows how to embed an external XML document (ZUGFeRD) into the created PDF/A document:

Loading...

Creating Fillable PDFs with Form Fields

TX Text Control provides a comprehensive way to create documents with fillable form elements such as form text boxes, check box fields and drop-down elements. The following code shows how to create a PDF document with form fields from scratch:

Loading...

Visual Components

Not being dependent on an additional third-party tool such as MS Word to create templates is a very important key aspect when implementing document processing functionality into business applications. The MS Word compatible editor has the look and feel of MS Word, but can be customized and adapted to user requirements. MS Word templates can be reused and edited in TX Text Control. Templates can be stored in industry standard(ized) formats such as DOCX, DOC and RTF and are always compatible with other word processors such as MS Word.

Creating documents with TX Text Control

Available for ASP.NET Core, ASP.NET MVC, Angular and React applications, the DocumentViewer is typically used to display documents and resulting reports in web applications. It provides a fully-featured interface to select text for clipboard actions, to search the text, a thumbnail side-bar view and a toolbar for typical tasks.

Viewing documents with TX Text Control

Conclusion

TX Text Control provides a feature-complete set of tools to create, modify and to edit Adobe PDF documents. Have a look at the live demo to see the Text Control components and libraries in action:

Live Demos