pdf-security-info
Use the pdf-security-info endpoint to upload a PDF document and return JSON describing the PDF.Refer to the following Users Guide page for more information illustrating how to call the endpoint directly as a REST call.
- Calling the
pdf-security-infoendpoint using REST (pdf-security-info REST API).
API
- C# (.NET)
- Java
- Node.js
- PHP
- Go
- Python
- Ruby
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.RC440EncryptionType.RC4128EncryptionType.Aes128EncryptionType.Aes256EncryptionType.None
And also returns the following values.
AllowEditAllowPrintAllowUpdateAnnotsAndFieldsAllowCopyAllowHighResolutionPrintingAllowDocumentAssemblyAllowFormFillingAllowAccessibilityEncryptAllExceptMetadataEncryptOnlyFileAttachmentsHasOwnerPasswordHasUserPassword
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; }
}
}
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);
}
}
}
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.RC440EncryptionType.RC4128EncryptionType.Aes128EncryptionType.Aes256EncryptionType.None
And also returns the following values.
AllowEditAllowPrintAllowUpdateAnnotsAndFieldsAllowCopyAllowHighResolutionPrintingAllowDocumentAssemblyAllowFormFillingAllowAccessibilityEncryptAllExceptMetadataEncryptOnlyFileAttachmentsHasOwnerPasswordHasUserPassword
PdfSecurityInfo.java
Example
package com.dynamicpdf.api.examples;
import com.dynamicpdf.api.DynamicPdfCloudApiExamples;
import com.dynamicpdf.api.PdfSecurityInfoEndpoint;
import com.dynamicpdf.api.PdfResource;
import com.dynamicpdf.api.PdfSecurityInfoResponse;
import com.dynamicpdf.api.PdfSecurityInfo;
public class PdfSecurityInfoExample {
public static void main(String[] args) {
PdfSecurityInfoExample.Run(DynamicPdfCloudApiExamples.API_KEY, DynamicPdfCloudApiExamples.BASE_DIR + "/security-info/");
}
public static void Run(String key, String basePath) {
PdfResource resource = new PdfResource(basePath + "aes256-security.pdf");
PdfSecurityInfoEndpoint psi = new PdfSecurityInfoEndpoint(resource);
psi.setApiKey(key);
PdfSecurityInfoResponse resp = psi.process();
PdfSecurityInfo info = resp.getContent();
System.out.println(resp.getJsonContent());
System.out.println("Encryption Type: " + info.getEncryptionTypeString());
}
}
TBD
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.RC440EncryptionType.RC4128EncryptionType.Aes128EncryptionType.Aes256EncryptionType.None
And also returns the following values.
AllowEditAllowPrintAllowUpdateAnnotsAndFieldsAllowCopyAllowHighResolutionPrintingAllowDocumentAssemblyAllowFormFillingAllowAccessibilityEncryptAllExceptMetadataEncryptOnlyFileAttachmentsHasOwnerPasswordHasUserPassword
PdfSecurityInfo.php
public static function Run(string $apikey, string $path)
{
$resource = new PdfResource($path . "aes256-security.pdf");
$pdfSecInfoEp = new PdfSecurityInfoEndpoint ($resource);
$pdfSecInfoEp ->ApiKey = $apikey;
$response = $pdfSecInfoEp->Process();
echo ($response->JsonContent);
$pdfSecInfo = new PdfSecurityInfo();
$data = json_decode($response->JsonContent, true);
$pdfSecInfo->encryptionTypeString = $data['encryptionType'] ?? null;
echo "Encryption Type: " . $pdfSecInfo->GetEncryptionType() . "\n";
}
TBD
TBD
TBD