Edit this page
Available for: UI for ASP.NET AJAX | UI for ASP.NET MVC | UI for WPF | UI for WinForms | UI for Silverlight

Settings

PdfFormatProvider provides you with the ability to import/export PDF documents. Additionally, you can take advantage of the import/export settings that give you modification options.

Import Settings

You can specify the import settings you wish through the ImportSettings property of PdfFormatProvider.The available import settings are listed below:

UserPasswordNeeded

The event is fired when a user password is needed to open the document. The password can be specified in the PasswordNeededEventArgs.Password property.

Example 1 shows how you can create a PdfImportSettings object and assign it to a PdfFormatProvider.

[C#] Example 1: Import settings

PdfFormatProvider provider = new PdfFormatProvider();
PdfImportSettings settings = new PdfImportSettings();
settings.UserPasswordNeeded += (s, a) =>
{
    a.Password = "D0cum3ntP4ssw0rd";
};

provider.ImportSettings = settings;

Export Settings

In order to modify the way content is exported, you can set the ExportSettings property of PdfFormatProvider. These are the modification options you can use:

IsEncrypted

This property specifies if the document should be encrypted. The default value is False.

This setting is ignored when ComplianceLevel differs from None as PDF/A compliant documents do not allow encryption.

UserPassword

The password to be used if the document is encrypted. The default password is an empty string.

ImageQuality

The ImageQuality property specifies the quality with which images are exported to PDF. More information about how it works is available in this article.

ComplianceLevel

Specifies the PDF/A compliance level. It can have one of the following values:

  • None: Specify no compliance level.
  • PdfA1B: Specify PDF/A-1b compliance level.
  • PdfA2B: Specify PDF/A-2b compliance level.
  • PdfA2U: Specify PDF/A-2u compliance level.
  • PdfA3B: Specify PDF/A-3b compliance level.
  • PdfA3U: Specify PDF/A-3u compliance level.

The default value is None. For more information on PDF/A compliance, check the PDF/A Compliance article.

Example 2 shows how you can create a PdfExportSettings object and assign it to a PdfFormatProvider.

[C#] Example 2: Export settings

PdfFormatProvider provider = new PdfFormatProvider();
PdfExportSettings settings = new PdfExportSettings();
settings.IsEncrypted = true;
settings.UserPassword = "D0cum3ntP4ssw0rd";
settings.ImageQuality = ImageQuality.Medium;
settings.ComplianceLevel = PdfComplianceLevel.PdfA2B;

provider.ExportSettings = settings;

See Also