         let pageCount = pdf?.numberOfPages ?? 0
         for index in 1...pageCount {
             if let page = pdf?.page(at: index) {
-                output.append(convertPageToImage(page: page))
+                if let img = convertPageToImage(page: page) {
+                   output.append(img)
+                }
             }
         }
         

        let backgroundImage = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        
        return backgroundImage!
    }
    
    class open func hasPassword(fileURL: URL) throws -> Bool {

        }
    }
    
    class open func convertPageToImage(page: CGPDFPage) -> UIImage? {
        let pageRect = page.getBoxRect(CGPDFBox.mediaBox)
        
        UIGraphicsBeginImageContext(pageRect.size)
