Linked Questions

Popular Questions

Check pdf is Password protected or not before iOS 11.0

Asked by At

I'm getting a url which contains an pdf document.

I need to ask the user for the password if it is protected.

The same is able to do after iOS 11.0 using PDFkit.

    if #available(iOS 11.0, *) {
                    if let pdfDocument = PDFDocument(url: url) {

                        print(pdfDocument.isEncrypted) 
                        print(pdfDocument.isLocked) 

                        if pdfDocument.isEncrypted {
                            // Its password protected
                        }
                    }
    }
    else {

    // Earlier versions..
    }

Is there any way to do this? without using any third party if possible

Related Questions