         return autoreleasepool { () -> Bool in
             if let provider = CGDataProvider(data: data as CFData) {
                 if let pdf = CGPDFDocument(provider) {
-                    if pdf.isUnlocked || pdf.isEncrypted {
+                    if pdf.isUnlocked == false || pdf.isEncrypted {
                         return true
                     }
                     return pdf.numberOfPages > 0

        return output
    }
    
    class open func convertImagesToPDF(images: [UIImage], password: String? = nil, scaleFactor: CGFloat = 1) throws -> Data? {
        return try convertImagesToPDF(images: images, documentPasswordInfo: (password == nil ? nil : PDFDocumentPasswordInfo(password: password!)), scaleFactor: scaleFactor)
    }

            let dataProvider = CGDataProvider(data: data as CFData)
            if let provider = dataProvider {
                if let pdf = CGPDFDocument(provider) {
                    if pdf.isUnlocked == false || pdf.isEncrypted {
                        return true
                    }
                }
