|
@@ -2245,6 +2245,18 @@ extension KMMainViewController {
|
|
|
}
|
|
|
}
|
|
|
@objc private func shareOriginalPDF(sender:KMToolbarViewController, limit: Bool = false) {
|
|
|
+ guard let pdfDoc = self.listView.document else {
|
|
|
+ NSSound.beep()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if !pdfDoc.allowsCopying || !pdfDoc.allowsPrinting {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .critical
|
|
|
+ alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
|
|
|
+ alert.runModal()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
if (limit) {
|
|
|
let document = self.listView.document ?? CPDFDocument()
|
|
|
var path: String?
|
|
@@ -2264,8 +2276,8 @@ extension KMMainViewController {
|
|
|
return;
|
|
|
}
|
|
|
let newDocument = CPDFDocument(url: URL(fileURLWithPath: path ?? ""))
|
|
|
-
|
|
|
- for i in 0 ... (newDocument?.pageCount ?? 1)-1 {
|
|
|
+ let cnt = newDocument?.pageCount ?? 0
|
|
|
+ for i in 0 ..< cnt {
|
|
|
let page = newDocument?.page(at: i)
|
|
|
var annotations : [CPDFAnnotation] = []
|
|
|
for annotation in page!.annotations {
|
|
@@ -2305,7 +2317,8 @@ extension KMMainViewController {
|
|
|
}
|
|
|
let newDocument = CPDFDocument(url: URL(fileURLWithPath: path ?? ""))
|
|
|
|
|
|
- for i in 0 ... (newDocument?.pageCount ?? 1)-1 {
|
|
|
+ let cnt = newDocument?.pageCount ?? 0
|
|
|
+ for i in 0 ..< cnt {
|
|
|
let page = newDocument!.page(at: i)
|
|
|
var annotations : [CPDFAnnotation] = []
|
|
|
for annotation in page!.annotations {
|