         if pdfView.displayDirection == .vertical {
             let frame = view.frame
             let aspectRatio = frame.size.width / frame.size.height
-            var scaleFactor = pdfView.scaleFactorForSizeToFit
+            // if it is iPhoneX, the pdfView.scaleFactorForSizeToFit is already optimized for save area
+            let divider = (pdfView.frame.width - pdfView.safeAreaInsets.left - pdfView.safeAreaInsets.right) / pdfView.frame.width
+            // the scaleFactor defines the super area scale factor
+            var scaleFactor = pdfView.scaleFactorForSizeToFit / divider
             if pdfView.displayMode == .twoUpContinuous {
                 scaleFactor *= 2
             }

        var landscape: CGFloat
        // devide by 2 for two up mode
    }
    var scaleFactorForSizeToFit: ScaleFactor?
    var scaleFactorVertical: ScaleFactor?
    var scaleFactorHorizontal: ScaleFactor?

    
    func setScaleFactorForUser() {
        var scaleFactor: ScaleFactor?
        // if user had opened this PDF before, the stored scaleFactor is already optimized for safeArea.
        if pdfView.displayDirection == .vertical {
            scaleFactor = scaleFactorVertical
        } else if pdfView.displayDirection == .horizontal {
