|
@@ -18,6 +18,12 @@ class KMPrintWindowController: NSWindowController, NetServiceBrowserDelegate {
|
|
|
@IBOutlet weak var bottomView: KMPrintBottomView!
|
|
|
|
|
|
var pdfDocument: CPDFDocument? = nil
|
|
|
+ var password: String = "" {
|
|
|
+ didSet {
|
|
|
+ self.preview.password = password
|
|
|
+ self.presenter.password = password
|
|
|
+ }
|
|
|
+ }
|
|
|
var isPrintPreView: Bool = true {
|
|
|
didSet {
|
|
|
self.preview.isPrintPreView = isPrintPreView
|
|
@@ -47,24 +53,25 @@ class KMPrintWindowController: NSWindowController, NetServiceBrowserDelegate {
|
|
|
self.preview.toPageIndex(UInt(inputPageRange.selectPages.first ?? 0))
|
|
|
}
|
|
|
}
|
|
|
- var inputData: URL? {
|
|
|
- didSet {
|
|
|
- let pdfDocument = CPDFDocument.init(url: inputData)
|
|
|
- self.chooseView.inputData = inputData
|
|
|
-
|
|
|
- if pdfDocument != nil {
|
|
|
- self.preview.pdfDocument = pdfDocument
|
|
|
- self.pdfDocument = pdfDocument
|
|
|
-
|
|
|
- self.presenter.initPresenter(delegate: self, data: self.chooseData, document: pdfDocument!)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// var inputData: URL? {
|
|
|
+// didSet {
|
|
|
+// let pdfDocument = CPDFDocument.init(url: inputData)
|
|
|
+// self.chooseView.inputData = inputData
|
|
|
+//
|
|
|
+// if pdfDocument != nil {
|
|
|
+// self.preview.pdfDocument = pdfDocument
|
|
|
+// self.pdfDocument = pdfDocument
|
|
|
+//
|
|
|
+// self.presenter.initPresenter(delegate: self, data: self.chooseData, document: pdfDocument!)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
var inputDocument: CPDFDocument? {
|
|
|
didSet {
|
|
|
pdfDocument = inputDocument
|
|
|
- self.chooseView.inputData = URL(string: "")
|
|
|
+ password = inputDocument?.password ?? ""
|
|
|
+// self.chooseView.inputData = URL(string: "")
|
|
|
|
|
|
if pdfDocument != nil {
|
|
|
self.preview.pdfDocument = pdfDocument
|
|
@@ -164,7 +171,7 @@ class KMPrintWindowController: NSWindowController, NetServiceBrowserDelegate {
|
|
|
KMPrintWindowController.showPrintWindowControll(inputData: nil, inputDocument: inputDocument, inputType: inputType,inputPageRange: inputPageRange)
|
|
|
}
|
|
|
|
|
|
- static func showNewPrintWindowControll(inputData: URL?, inputDocument: CPDFDocument?, inputType: DataNavigationViewButtonActionType = .Print, inputPageRange: KMPrintPageRange, printType: KMPrintModelType = .size) {
|
|
|
+ static func showNewPrintWindowControll(inputDocument: CPDFDocument?, inputType: DataNavigationViewButtonActionType = .Print, inputPageRange: KMPrintPageRange, printType: KMPrintModelType = .size) {
|
|
|
let printWindowController: KMPrintWindowController = KMPrintWindowController.init(windowNibName: "KMPrintWindowController")
|
|
|
|
|
|
printWindowController.printType = printType
|
|
@@ -193,10 +200,7 @@ class KMPrintWindowController: NSWindowController, NetServiceBrowserDelegate {
|
|
|
if inputDocument != nil {
|
|
|
printWindowController.inputDocument = inputDocument
|
|
|
}
|
|
|
-
|
|
|
- if inputData != nil {
|
|
|
- printWindowController.inputData = inputData
|
|
|
- }
|
|
|
+
|
|
|
printWindowController.inputType = inputType
|
|
|
printWindowController.inputPageRange = inputPageRange
|
|
|
}
|
|
@@ -394,21 +398,21 @@ extension KMPrintWindowController: KMPrintBottomViewDelegate {
|
|
|
self.changeTypeAction?(self, .poster)
|
|
|
self.cancelAction()
|
|
|
|
|
|
- KMPrintWindowController.showNewPrintWindowControll(inputData: self.pdfDocument?.documentURL, inputDocument: nil, inputPageRange: KMPrintPageRange(), printType: .poster)
|
|
|
+ KMPrintWindowController.showNewPrintWindowControll(inputDocument: self.pdfDocument, inputPageRange: KMPrintPageRange(), printType: .poster)
|
|
|
}
|
|
|
|
|
|
func multipageAction() {
|
|
|
self.changeTypeAction?(self, .multipage)
|
|
|
self.cancelAction()
|
|
|
|
|
|
- KMPrintWindowController.showNewPrintWindowControll(inputData: self.pdfDocument?.documentURL, inputDocument: nil, inputPageRange: KMPrintPageRange(), printType: .multipage)
|
|
|
+ KMPrintWindowController.showNewPrintWindowControll(inputDocument: self.pdfDocument, inputPageRange: KMPrintPageRange(), printType: .multipage)
|
|
|
}
|
|
|
|
|
|
func bookletAction() {
|
|
|
self.changeTypeAction?(self, .pamphlet)
|
|
|
self.cancelAction()
|
|
|
|
|
|
- KMPrintWindowController.showNewPrintWindowControll(inputData: self.pdfDocument?.documentURL, inputDocument: nil, inputPageRange: KMPrintPageRange(), printType: .pamphlet)
|
|
|
+ KMPrintWindowController.showNewPrintWindowControll(inputDocument: self.pdfDocument, inputPageRange: KMPrintPageRange(), printType: .pamphlet)
|
|
|
}
|
|
|
}
|
|
|
|