Products Technologies Demo Docs Blog Support Company
TX Text Control 34.0 SP1 has been released - Learn more

Exporting Password Protected PDF Documents

With TX Text Control ships a sample application called TX Text Control Words. Amongst other things, TX Text Control Words illustrates how to export password protected PDF documents. In the following paragraphs, I would like to explain in detail how password protected PDF documents are exported. I receive - on an almost daily basis - questions about this topic. Using the TXTextControl.SaveSettings class, you can declare two passwords: the UserPassword to open the document and the…

Exporting Password Protected PDF Documents

With TX Text Control ships a sample application called TX Text Control Words. Amongst other things, TX Text Control Words illustrates how to export password protected PDF documents.

In the following paragraphs, I would like to explain in detail how password protected PDF documents are exported. I receive - on an almost daily basis - questions about this topic.

Using the TXTextControl.SaveSettings class, you can declare two passwords: the UserPassword to open the document and the MasterPassword for the document's access permissions. These permissions can be set using the SaveSettings.DocumentAccessPersmissions 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 UserPassword must be entered, if the PDF is opened by the user. The MasterPassword must be entered, if the user is trying to change the permissions. The sample below shows how to export a PDF which allows low level printing. If the user would like to print the document in a higher level, the permissions must be changed and the password must be entered.

Dim saveSettings As New TXTextControl.SaveSettings

saveSettings.MasterPassword = "Master"
saveSettings.UserPassword = "User"

saveSettings.DocumentAccessPermissions =
    TXTextControl.DocumentAccessPermissions.AllowLowLevelPrinting

TextControl1.Save(TXTextControl.StreamType.AdobePDF, saveSettings)

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

PDFSample

Source Code to Send PDF As an E-mail Attachment

Sample code to illustrate how easy it is to sent the contents of a TX Text Control via e-mail as a PDF attachment. Download the source code.


ASP.NETASP.NET CoreMIME

Why Defining MIME Types for PDF/A Attachments Is Essential

The PDF/A standard was created to ensure the long-term reliable archiving of digital documents. An important aspect of the standard involves properly handling embedded files and attachments within…


ASP.NETASP.NET CorePDF

Validate Digital Signatures and the Integrity of PDF Documents in C# .NET

Learn how to validate digital signatures and the integrity of PDF documents using the PDF Validation component from TX Text Control in C# .NET. Ensure the authenticity and compliance of your…


ASP.NETASP.NET CorePDF

Validate PDF/UA Documents and Verify Electronic Signatures in C# .NET

The new TXTextControl.PDF.Validation NuGet package enables you to validate PDF/UA documents and verify digital signatures directly in your code without relying on third-party tools or external…


ASP.NETASP.NET CoreC#

How To Choose the Right C# PDF Generation Library: Developer Checklist

To make your choice easy, this guide provides a systematic evaluation framework for two library categories: basic and enterprise PDF libraries. It covers matching features to use cases, evaluating…

Summarize this blog post with:

Share on this blog post on: