Telerik blogs

A lot of new features were introduced in the latest PdfProcessing release. In this blog, I will introduce and show how you can use them with some examples.

PDF Signature Flags

With the latest version, we have introduced the ability to set the signature flags. The possible values are as specified in the PDF Standard.

  • None: The document does not contain signatures.
  • SignaturesExist: If set, the document contains at least one signature field.
  • AppendOnly: The document contains signatures that may be invalidated if the file is saved in a way that alters its previous contents.

With this functionality, you can specify that there is a signature, even if the signature itself does not have a visual representation. For example, you can create a signature without visible content (empty widget) and set the flags like with the following code:

X509Certificate2 certificate = new X509Certificate2("Test.pfx", "Password");

string signatureName = "SigantuireName";

SignatureField signatureField = new SignatureField(signatureName)
{
    Signature = new Signature(certificate)
};

SignatureWidget widget = signatureField.Widgets.AddWidget();

RadFixedPage page = document.Pages[0];
page.Annotations.Add(widget);

document.AcroForm.FormFields.Add(signatureField);

document.AcroForm.SignatureFlags = SignatureFlags.SignaturesExist | SignatureFlags.AppendOnly;

Setting the User Access Permissions of Encrypted Documents

This functionality allows you to specify printing, copying and changing permissions of encrypted documents. This can be useful when you want to provide the document only for viewing, and prevent copying or printing the contents. Here are the available options:

  • Printing options allow you to forbid printing or use low- or high-resolution printing.
  • Copying options allow you to restrict the copying and allow just the text to be copied.
  • Editing options control if the fields can be edited and the document can be signed. You can control if the user can edit or add new content as well.

A complete list of the settings is available in our documentation: Export Settings.

Support for Type 3 Fonts

This highly demanded feature is now completed, and you can use files that contain such fonts with our library without issues. The Type 3 fonts are PDF-related features where the glyphs are rendered with the drawing operators from the PDF standard. The glyphs can contain lines, areas, shades of gray, graduated fills or variable stroke widths. Type 3 fonts can contain images as well. This makes them useful for logos, for example. Each stream contains the character’s name. This requires an encoding that will be used to map the character codes with the names.

Here are some examples that show what can be done with the Type 3 fonts:

pdf-features-r2-2020-blog1pdf-features-r2-2020-blog2

Font Embedding Is No Longer Mandatory

This is one of the most demanded features as well. Now you can specify if the fonts should be embedded in the documents before exporting them. This way you can significantly reduce the file size. However, please note that if the fonts are not present on the current operating system the file may not look exactly like intended and the used PdfViewer may fall back to other fonts. If you are using the .NET Standard version, you will need to provide the fonts using the FontsProvider.

This is controlled by a single property of the export settings:

PdfFormatProvider formatProvider = new PdfFormatProvider();
formatProvider.ExportSettings.ShouldEmbedFonts = false;

The default value is true since we want to keep the current behavior intact.

Try It and Share Your Feedback

No matter if you are already familiar with Telerik Document Processing or will meet the libraries for the first time, hurry up and get the latest bits so you can take advantage of the different document management possibilities they provide:

Download a Free Trial

And I am sure I have told you many times that your input is valuable. We do listen. So, do not be shy and drop us a line to share your feedback in the comments section below or directly in our Document Processing Libraries Feedback Portal.


About the Author

Dimitar Karamfilov

Dimitar Karamfilov is a Support Officer in the UI for WinForms team. He joined Telerik after graduating from the Telerik Academy in 2013. Apart from work he likes outdoor activities and reading philosophy literature.

Related Posts

Comments

Comments are disabled in preview mode.