                     self.getScaleFactorForSizeToFit()
                 }
                 
-//                if let currentPage = self.pdfView.currentPage {
-//                    let pageSize = self.pdfView.rowSize(for: currentPage)
-//                    if (pageSize.width > pageSize.height) {
-//                        self.writing(vertically: true, rightToLeft: true)
-//                    }
-//                }
+                self.writing(vertically: self.isVerticalWriting, rightToLeft: self.isRightToLeft)
                 
                 self.setPDFThumbnailView()
             } else {

                    isRightToLeft = rightToLeft
                }
                
            }
        }
        

                    } else {
                        pdfView.displayDirection = .vertical
                    }
                    isVerticalWriting = vertically
                }
                
                if rightToLeft != isRightToLeft {
