You can use the following snippet to detect files with custom encryption (including Adobe DRM):
PDFNet.Initialize();
Try {
using (PDFDoc doc = new PDFDoc("my.pdf"))
{
try {
if (!doc.InitSecurityHandler()) {
Console.WriteLine("Document authentication error...");
}
}
catch(PDFNetException e) {
Console.WriteLine(e.Message);
Console.WriteLine(doc.GetTrailer().Get("Encrypt").Value().Get("Filter").Value().GetName());
}
}
}
catch (PDFNetException e) {
Console.WriteLine(e.Message);
}
The output will be:
Exception: Requested security handler was not found.
Adobe.APS