         containerView.frame = viewFrame
         contentView.frame = containerView.bounds
     }
-    
+
     override open func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
-        
+
         guard context == &PDFPageContentViewContext,
             let keyPath = keyPath, keyPath == "frame",
             self == (object as? PDFPageContentView) else {
             return
         }
-        
+
         updateMinimumMaximumZoom()
         self.zoomReset()
     }
-    
+
     open func processSingleTap(_ recognizer: UITapGestureRecognizer) {
         if let action = contentView.processSingleTap(recognizer) as? PDFAction {
             contentDelegate?.contentView(self, didSelect: action)


        contentInset = UIEdgeInsetsMake(0, 0, height, 0)
    }
    
    
    //MARK: - Helper methods
    static func zoomScaleThatFits(_ target: CGSize, source: CGSize) -> CGFloat {
        let widthScale = target.width / source.width
        let heightScale = target.height / source.height
        return (widthScale < heightScale) ? widthScale : heightScale
    }
    
    func updateMinimumMaximumZoom() {
        previousScale = self.zoomScale
        let targetRect = bounds.insetBy(dx: 0, dy: 0)
        let zoomScale = PDFPageContentView.zoomScaleThatFits(targetRect.size, source: contentView.bounds.size)
        
        minimumZoomScale = zoomScale
        maximumZoomScale = zoomScale * 16.0
    }

    required public init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    deinit {
        NotificationCenter.default.removeObserver(self, name: .UIKeyboardWillShow, object: nil)
        NotificationCenter.default.removeObserver(self, name: .UIKeyboardWillHide, object: nil)

        self.removeObserver(self, forKeyPath: "frame")
    }

    override open func layoutSubviews() {
        super.layoutSubviews()

        let boundsSize = bounds.size
        var viewFrame = containerView.frame

        if viewFrame.size.width < boundsSize.width {
            viewFrame.origin.x = (boundsSize.width - viewFrame.size.width) / 2.0 + contentOffset.x
        } else {
            viewFrame.origin.x = 0.0
        }

        if viewFrame.size.height < boundsSize.height {
            viewFrame.origin.y = (boundsSize.height - viewFrame.size.height) / 2.0 + contentOffset.y
        }
