     }
     
     func moveToLastReadingProsess() {
-        let pageIndex = self.userDeaults.integer(forKey: (self.pdfView.document?.documentURL?.path)!)
+        var pageIndex = 0
+        if self.userDeaults.object(forKey: (self.pdfView.document?.documentURL?.path)!) != nil {
+            // key exists
+            pageIndex = self.userDeaults.integer(forKey: (self.pdfView.document?.documentURL?.path)!)
+        } else if verticalWriting {
+            // 初めて読む　且つ　縦書き
+            pageIndex = (self.pdfView.document?.pageCount)! - 1
+        }
+        
+        // TODO: if pageIndex == pageCount - 1, then go to last CGRect
         self.pdfView.go(to: (self.pdfView.document?.page(at: pageIndex)!)!)
     }
     

        pdfView.autoScales = true
        pdfView.displaysPageBreaks = false
        pdfView.displayBox = .cropBox
        
        
        let center = NotificationCenter.default

            
                if let document = PDFDocument(url: (self.document?.fileURL)!) {
                    self.pdfView.document = document
                    let pageSize = self.pdfView.rowSize(for: self.pdfView.currentPage!)
                    
                    if (pageSize.width > pageSize.height) {
                        self.pdfView.displayDirection = .horizontal
                        self.verticalWriting = true
                        // document must be reset after displayDirection setted
                        self.pdfView.document = nil
                        self.pdfView.document = document
                    }
                    
                    if self.verticalWriting {
                        // ページ交換ファンクションを利用して、降順ソートして置き換える。
                        let actionCount = document.pageCount/2
                        for i in 0...actionCount{
                            document.exchangePage(at: i, withPageAt: document.pageCount-i)
                        }
                    }

                    self.moveToLastReadingProsess()
                }
            } else {
