Skip to main content

pdf-security-info


Use the pdf-security-info endpoint to upload a PDF document and return JSON describing the PDF.
important

Refer to the following Users Guide page for more information illustrating how to call the endpoint directly as a REST call.

API

The PdfSecurityInfoEndpoint class encapsulates the pdf-security-info endpoint. A PdfSecurityInfoEndpoint instance takes a PdfResource instance and returns a PdfSecurityInfoResponse which contains a PdfSecurityInfo instance.

PdfSecurityInfo

Encapsulates the JSON response from a PdfSecurityInfoResponse. Contains an EncryptionType enumerated value and values of the PDF's security settings.

Valid EncryptionType values are:

  • EncryptionType.RC440
  • EncryptionType.RC4128
  • EncryptionType.Aes128
  • EncryptionType.Aes256
  • EncryptionType.None

And also returns the following values.

  • AllowEdit
  • AllowPrint
  • AllowUpdateAnnotsAndFields
  • AllowCopy
  • AllowHighResolutionPrinting
  • AllowDocumentAssembly
  • AllowFormFilling
  • AllowAccessibility
  • EncryptAllExceptMetadata
  • EncryptOnlyFileAttachments
  • HasOwnerPassword
  • HasUserPassword

using Newtonsoft.Json;

namespace DynamicPDF.Api
{
//
// Summary:
// Represents the pdf security info endpoint.
public class PdfSecurityInfo
{
public PdfSecurityInfo();

//
// Summary:
// Gets or sets the encryption type.
[JsonProperty("encryptionType")]
public string EncryptionTypeString { get; set; }
[JsonIgnore]
public EncryptionType EncryptionType { get; }
//
// Summary:
// Gets or sets if the document can be edited by the user.
public bool? AllowEdit { get; set; }
//
// Summary:
// Gets or sets if the document can be printed by the user.
public bool? AllowPrint { get; set; }
//
// Summary:
// Gets or sets if annotations and form fields can be added, edited and modified
// by the user.
public bool? AllowUpdateAnnotsAndFields { get; set; }
//
// Summary:
// Gets or sets if text and images can be copied to the clipboard by the user.
public bool? AllowCopy { get; set; }
//
// Summary:
// Gets or sets if the document can be printed at a high resolution by the user.
public bool? AllowHighResolutionPrinting { get; set; }
//
// Summary:
// Gets or sets if the document can be assembled and manipulated by the user.
public bool? AllowDocumentAssembly { get; set; }
//
// Summary:
// Gets or sets if form filling should be allowed by the user.
public bool? AllowFormFilling { get; set; }
//
// Summary:
// Gets or sets if accessibility programs should be able to read the documents text
// and images for the user.
public bool? AllowAccessibility { get; set; }
//
// Summary:
// Gets or sets a value indicating whether all data should be encrypted except for
// metadata.
public bool? EncryptAllExceptMetadata { get; set; }
//
// Summary:
// Gets or sets a value indicating whether only file attachments should be encrypted.
public bool? EncryptOnlyFileAttachments { get; set; }
//
// Summary:
// Gets or sets a value indicating whether the PDF document has an owner password
// set.
public bool HasOwnerPassword { get; set; }
//
// Summary:
// Gets or sets a value indicating whether the PDF document has an user password
// set.
public bool HasUserPassword { get; set; }
}
}
Source: PdfSecurityInfo.cs

Example

using DynamicPDF.Api;
using System;

namespace DynamicPdfClientLibraryExamples.Examples
{
public class PdfSecurityInfoExample
{
public static void Run(string apiKey, string basePath)
{
PdfResource resource = new PdfResource(basePath + "aes256-security.pdf");
PdfSecurityInfoEndpoint secInfoEndpoint = new PdfSecurityInfoEndpoint(resource);
secInfoEndpoint.ApiKey = apiKey;
PdfSecurityInfoResponse resp = secInfoEndpoint.Process();
PdfSecurityInfo info = resp.Content;
Console.WriteLine(resp.JsonContent);
Console.WriteLine("EncryptionType: " + info.EncryptionTypeString);

}
}
}
Source: PdfSecurityInfoExample.cs
   Follow us on social media for latest news!