|
@@ -496,7 +496,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
- let pageCnt = self.listView?.document?.pageCount ?? 0
|
|
|
+ let pageCnt = self.pdfDocument?.pageCount ?? 0
|
|
|
if (self.thumbnailView.selectionIndexPaths.count == pageCnt) {
|
|
|
self._progressHUD(message: NSLocalizedString("Can not delete all pages.", comment: ""))
|
|
|
return
|
|
@@ -958,12 +958,12 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
var originalIndex = self.listViewCurrentIndex
|
|
|
// 从后面往前删除
|
|
|
for index in indexs.reversed() {
|
|
|
- let newPage = (self.listView?.document.page(at: UInt(index)))?.copy() as? CPDFPage
|
|
|
+ let newPage = (self.pdfDocument?.page(at: UInt(index)))?.copy() as? CPDFPage
|
|
|
if (newPage == nil) {
|
|
|
continue
|
|
|
}
|
|
|
newPages.insert(newPage!, at: 0)
|
|
|
- self.listView?.document.removePage(at: UInt(index))
|
|
|
+ self.pdfDocument?.removePage(at: UInt(index))
|
|
|
if (index < toIndex) { /// 删除了插入位置前面的页面,需要改变 toIndex
|
|
|
toIndexOffset += 1
|
|
|
}
|
|
@@ -977,7 +977,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
let insertIndex = max(0, toIndex-toIndexOffset)
|
|
|
var selectIndexs: IndexSet = []
|
|
|
for (index, page) in newPages.enumerated() {
|
|
|
- self.listView?.document.insertPageObject(page, at: UInt(insertIndex+index))
|
|
|
+ self.pdfDocument?.insertPageObject(page, at: UInt(insertIndex+index))
|
|
|
selectIndexs.insert(insertIndex+index)
|
|
|
if (currentPage?.pageIndex() == page.pageIndex()) {
|
|
|
// self._listViewCurrentIndex = insertIndex+index
|
|
@@ -1022,7 +1022,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
|
|
|
// 从后面开始删除
|
|
|
for index in datas.reversed() {
|
|
|
- self.listView?.document.removePage(at: UInt(index))
|
|
|
+ self.pdfDocument?.removePage(at: UInt(index))
|
|
|
}
|
|
|
// 再插入到对应的位置
|
|
|
for (index,value) in indexs.enumerated() {
|
|
@@ -1031,7 +1031,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
page = pages[index]
|
|
|
}
|
|
|
if (page != nil) {
|
|
|
- self.listView?.document.insertPageObject(page!, at: UInt(value))
|
|
|
+ self.pdfDocument?.insertPageObject(page!, at: UInt(value))
|
|
|
}
|
|
|
|
|
|
}
|