Foxit Quick PDF Library

Code to check PDFs for security settings

The AnalyseFile function can be used to check a PDF for security settings. If the PDF has an open password then this password will need to be passed to the AnalyseFile function before you can check the permissions for the PDF.

private void btnAnalyseFile_Click(object sender, EventArgs e)
string[] item1 = { "Filename", "Filesize", "Author", "Title", "Subject", "Keywords",
"Creator", "Producer", "PDFVersion", "PageCount", "CreationDate", 
"ModificationDate", "DocumentID", "PasswordType", "UsageRights", 
"UsageRightsSignature" }; 

string[] item2 = { "Security Method", "User Password", "Master Password", "Printing", "Changing the Document", 
"Content Copying or Extraction", "Authoring Comments and Form Fields", "Form Field Fill-in or Signing", 
"Content Accessibility Enabled", "Document Assembly", "Encryption Level" }; 

string[] result = { "None", "Adobe Standard Security", "No", "Yes", "Fully Allowed", "Not Allowed", "Allowed", 
"40-bit RC4 (Acrobat 3.x, 4.x)", "128-bit RC4 (Acrobat 5.x)", "Unknown", "Low resolution", 
"Blank", "128-bit AES (Acrobat 7.x)" }; 

string s; 
int ret; 


if (openFileDialog1.ShowDialog() == DialogResult.OK) 
string msg = "Results from Ananysis()\n"; 

int aid = DPL.AnalyseFile(openFileDialog1.FileName, ""); 

for (int i = 0; i <= 15; i++) 
string s1 = DPL.GetAnalysisInfo(aid, i); 
msg += String.Format("[{0}]{1} = {2}\n", i, item1[i], s1); 

for (int i = 0; i <= 10; i++) 
string s1 = DPL.GetAnalysisInfo(aid, i + 20); 
msg += String.Format("[{0}]{1} = [{2}]{3}\n", i, item2[i], s1, result[int.Parse(s1)]); 


ret = DPL.LoadFromFile(openFileDialog1.FileName, ""); 
msg += "\n\nResults from SecurityInfo()\n"; 

for (int i = 0; i <= 10; i++) 
ret = DPL.SecurityInfo(i); 

s = String.Format("[{0}]{1} = [{2}]{3}\n", i, item2[i], ret, result[ret]); 
msg += s; 

This article refers to a deprecated product. If you are looking for support for Foxit PDF SDK, please click here.

Updated on May 16, 2022

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: