Search code examples
pdfblueprism

Detecting PDF is corrupt or password protected by Blue Prism


Is there any VBO or method in Blue Prism to detect if a PDF is corrupt (meaning can't be opened) or password protected. So that can be stored as a boolean value in a decision variable?


Solution

  • This was solved by using the SRI Infotech PDF Utility asset from Blue Prism DX portal. It has a itextsharp.dll and a VBO for PDF functionalities. Custom coding in C# was required to solve the problem statement. The custom C# code used was

    pdfErrorMessage="";
    validPdf=false;
    try{
    PdfReader r = new PdfReader(pdfFilePath);
    if (r.IsOpenedWithFullPermissions)
    {
       validPdf=true;
    }
    }
    catch(Exception e) {
     pdfErrorMessage = e.ToString();
     validPdf=false;
    }