     private weak var pageViewDelegate: PDFPageViewDelegate?
     
     init(frame: CGRect, document: PDFDocument, pageNumber: Int, pageViewDelegate: PDFPageViewDelegate?) {
-        let backgroundImage = document.getPDFPageImage(pageNumber + 1)
+        let backgroundImage = document.getPDFPageImage(at: pageNumber + 1)
         guard let pageRef = document.coreDocument.page(at: pageNumber + 1) else { fatalError() }
         
         PDFPage = pageRef
         self.pageViewDelegate = pageViewDelegate
         
         // Determine the size of the PDF page.
-        var pageRect = PDFPage.getBoxRect(CGPDFBox.mediaBox)
+        var pageRect = PDFPage.getBoxRect(.mediaBox)
         PDFScale = min(frame.size.width/pageRect.size.width, frame.size.height/pageRect.size.height)
-        pageRect.size = CGSize(width: pageRect.size.width * PDFScale!, height: pageRect.size.height * PDFScale!)
+        pageRect.size = CGSize(width: pageRect.size.width * PDFScale, height: pageRect.size.height * PDFScale)
         
         guard !pageRect.isEmpty else { fatalError() }
         

        sendSubview(toBack: backgroundImageView)
        addSubview(tiledPDFView)
        
        let doubleTapOne = UITapGestureRecognizer(target: self, action:#selector(PDFPageView.handleDoubleTap(_:)))
        doubleTapOne.numberOfTapsRequired = 2
        doubleTapOne.cancelsTouchesInView = false
        addGestureRecognizer(doubleTapOne)
        
        let singleTapOne = UITapGestureRecognizer(target: self, action:#selector(PDFPageView.handleSingleTap(_:)))
        singleTapOne.numberOfTapsRequired = 1
        singleTapOne.cancelsTouchesInView = false
        addGestureRecognizer(singleTapOne)

        backgroundImageView.frame = pageRect
        
        // Create the TiledPDFView based on the size of the PDF page and scale it to fit the view.
        tiledPDFView = TiledView(frame: pageRect, scale: PDFScale, newPage: PDFPage)
        
        super.init(frame: frame)
        
