|
@@ -448,6 +448,7 @@ class KMWatermarkView: KMBaseXibView, NSTextFieldDelegate, NSComboBoxDelegate, N
|
|
|
func checkPageRangeValidate(_ pageRangeString: String) -> Bool {
|
|
|
let fileAttribute = KMFileAttribute()
|
|
|
fileAttribute.filePath = (self.pdfDocument?.documentURL.path)!
|
|
|
+ fileAttribute.password = self.pdfDocument?.password ?? ""
|
|
|
fileAttribute.bAllPage = false
|
|
|
fileAttribute.pagesString = self.pageRangeComboBox.stringValue
|
|
|
|
|
@@ -743,7 +744,26 @@ extension KMWatermarkView {
|
|
|
|
|
|
@IBAction func buttonClicked_Done(_ sender: Any) {
|
|
|
if checkPageRangeValidate(pageRangeComboBox.stringValue) {
|
|
|
- self.watermark.pagesString = pageRangeComboBox.stringValue
|
|
|
+ if watermark.pageRangeType == .other {
|
|
|
+ var pageString: String = ""
|
|
|
+ let fileAttribute = KMFileAttribute()
|
|
|
+ fileAttribute.filePath = (self.pdfDocument?.documentURL.path)!
|
|
|
+ fileAttribute.password = self.pdfDocument?.password ?? ""
|
|
|
+ fileAttribute.bAllPage = false
|
|
|
+ fileAttribute.pagesType = .custom
|
|
|
+ fileAttribute.pagesString = self.pageRangeComboBox.stringValue
|
|
|
+ let pages = fileAttribute.fetchSelectPages()
|
|
|
+ for i in 0 ..< pages.count {
|
|
|
+ pageString.append("\(pages[i] - 1)")
|
|
|
+
|
|
|
+ if (i != pages.count-1) {
|
|
|
+ pageString.append(",")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.watermark.pagesString = pageString
|
|
|
+ } else {
|
|
|
+ self.watermark.pagesString = self.pageRangeComboBox.stringValue
|
|
|
+ }
|
|
|
updatePDFView()
|
|
|
}
|
|
|
|