|
@@ -90,8 +90,6 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(signatureTrustCerDidChangeNotification(_:)), name: CSignatureTrustCerDidChangeNotification, object: nil)
|
|
|
|
|
|
NotificationCenter.default.addObserver(self, selector: #selector(PDFPageDidRemoveAnnotationNotification), name: NSNotification.Name.CPDFPageDidRemoveAnnotation, object: nil)
|
|
|
-
|
|
|
- self.pdfListView?.performDelegate = self
|
|
|
}
|
|
|
|
|
|
func initAnnotationBar() {
|
|
@@ -147,19 +145,6 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
self.digitalSignatureBar?.delegate = self
|
|
|
}
|
|
|
|
|
|
- override func initWitNavigationTitle() {
|
|
|
- //titleButton
|
|
|
- let navTitleButton = CNavigationBarTitleButton.init()
|
|
|
- self.titleButton = navTitleButton
|
|
|
- self.navigationTitle = NSLocalizedString("View", comment: "")
|
|
|
- navTitleButton.setImage(UIImage.init(named: "syasarrow"), for: .normal)
|
|
|
- navTitleButton.addTarget(self, action: #selector(titleButtonClickd(_:)), for: .touchUpInside)
|
|
|
- navTitleButton.setTitle(self.navigationTitle as String?, for: .normal)
|
|
|
- navTitleButton.setTitleColor(CPDFColorUtils.CAnyReverseBackgooundColor(), for: .normal)
|
|
|
- self.titleButton?.frame = CGRect(x: 0, y: 0, width: 50, height: 30)
|
|
|
- self.navigationItem.titleView = self.titleButton
|
|
|
- }
|
|
|
-
|
|
|
override func viewDidLayoutSubviews() {
|
|
|
super.viewDidLayoutSubviews()
|
|
|
|
|
@@ -545,6 +530,10 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
|
|
|
func writeSignatureToWidget(_ widget: CPDFSignatureWidgetAnnotation, PKCS12Cert path: String, password: String, config: CPDFSignatureConfig, lockDocument isLock: Bool) {
|
|
|
let writeDirectoryPath = SIGNATURESFOLDER
|
|
|
+
|
|
|
+ if !FileManager.default.fileExists(atPath: writeDirectoryPath) {
|
|
|
+ try? FileManager.default.createDirectory(at: URL(fileURLWithPath: writeDirectoryPath), withIntermediateDirectories: true)
|
|
|
+ }
|
|
|
|
|
|
let documentURL = self.pdfListView?.document.documentURL
|
|
|
let documentName = documentURL?.lastPathComponent.components(separatedBy: ".").first ?? ""
|
|
@@ -667,7 +656,7 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func pdfViewEditingSelectStateDidChanged(_ pdfView: CPDFView) {
|
|
|
+ override func pdfViewEditingSelectStateDidChanged(_ pdfView: CPDFView) {
|
|
|
if pdfView.editingArea() is CPDFEditImageArea {
|
|
|
self.editMode = .image
|
|
|
} else if pdfView.editingArea() is CPDFEditTextArea {
|
|
@@ -676,13 +665,13 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
self.toolBar?.updateButtonState()
|
|
|
}
|
|
|
|
|
|
- func pdfViewShouldBeginEditing(_ pdfView: CPDFView, textView: UITextView, for annotation: CPDFFreeTextAnnotation) {
|
|
|
+ override func pdfViewShouldBeginEditing(_ pdfView: CPDFView, textView: UITextView, for annotation: CPDFFreeTextAnnotation) {
|
|
|
let keyboardToolbar = CPDFKeyboardToolbar(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: 50))
|
|
|
keyboardToolbar.delegate = self
|
|
|
keyboardToolbar.bindToTextView(textView)
|
|
|
}
|
|
|
|
|
|
- func pdfViewEditingAddTextArea(_ pdfView: CPDFView, add page: CPDFPage, add rect: CGRect) {
|
|
|
+ override func pdfViewEditingAddTextArea(_ pdfView: CPDFView, add page: CPDFPage, add rect: CGRect) {
|
|
|
var fontColor = CPDFTextProperty.shared.fontColor
|
|
|
var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0
|
|
|
fontColor?.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
|
|
@@ -704,7 +693,7 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
self.pdfListView?.createEmptyStringBounds(rect,withAttributes: dic, page: page)
|
|
|
}
|
|
|
|
|
|
- func pdfViewEditingAddImageArea(_ pdfView: CPDFView, add page: CPDFPage, add rect: CGRect) {
|
|
|
+ override func pdfViewEditingAddImageArea(_ pdfView: CPDFView, add page: CPDFPage, add rect: CGRect) {
|
|
|
self.addImageRect = rect
|
|
|
self.addImagePage = page
|
|
|
let imagePicker = UIImagePickerController()
|
|
@@ -741,7 +730,7 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
|
|
|
// MARK: - CPDFListViewDelegate
|
|
|
|
|
|
- func PDFListViewPerformTouchEnded(_ pdfListView: CPDFListView) {
|
|
|
+ override func PDFListViewPerformTouchEnded(_ pdfListView: CPDFListView) {
|
|
|
|
|
|
if CToolModel.annotation == self.pdfListView?.toolModel {
|
|
|
if self.navigationController?.isNavigationBarHidden ?? false {
|
|
@@ -824,7 +813,7 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
}
|
|
|
|
|
|
|
|
|
- func PDFListViewEditNote(_ pdfListView: CPDFListView, forAnnotation annotation: CPDFAnnotation) {
|
|
|
+ override func PDFListViewEditNote(_ pdfListView: CPDFListView, forAnnotation annotation: CPDFAnnotation) {
|
|
|
if annotation is CPDFLinkAnnotation {
|
|
|
self.annotationBar?.buttonItemClicked_openAnnotation(self.titleButton)
|
|
|
} else if annotation is CPDFWidgetAnnotation {
|
|
@@ -837,7 +826,7 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func PDFListViewChangedAnnotationType(_ pdfListView: CPDFListView, forAnnotationMode annotationMode: Int) {
|
|
|
+ override func PDFListViewChangedAnnotationType(_ pdfListView: CPDFListView, forAnnotationMode annotationMode: Int) {
|
|
|
if self.pdfListView?.toolModel == .annotation {
|
|
|
self.annotationBar?.reloadData()
|
|
|
} else if self.pdfListView?.toolModel == .form {
|
|
@@ -845,26 +834,27 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func PDFListViewPerformAddStamp(_ pdfView: CPDFListView, atPoint point: CGPoint, forPage page: CPDFPage) {
|
|
|
+ override func PDFListViewPerformAddStamp(_ pdfView: CPDFListView, atPoint point: CGPoint, forPage page: CPDFPage) {
|
|
|
self.annotationBar?.addStampAnnotation(withPage: page, point: point)
|
|
|
}
|
|
|
|
|
|
- func PDFListViewPerformAddImage(_ pdfView: CPDFListView, atPoint point: CGPoint, forPage page: CPDFPage) {
|
|
|
+ override func PDFListViewPerformAddImage(_ pdfView: CPDFListView, atPoint point: CGPoint, forPage page: CPDFPage) {
|
|
|
self.annotationBar?.addImageAnnotation(withPage: page, point: point)
|
|
|
}
|
|
|
|
|
|
- func PDFListViewerTouchEndedIsAudioRecordMedia(_ pdfListView: CPDFListView) -> Bool {
|
|
|
+ override func PDFListViewerTouchEndedIsAudioRecordMedia(_ pdfListView: CPDFListView) -> Bool {
|
|
|
if CPDFMediaManager.sharedManager.mediaState == .audioRecord {
|
|
|
self.PDFListViewPerformTouchEnded(pdfListView)
|
|
|
return true
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
- func PDFListViewPerformCancelMedia(_ pdfView: CPDFListView, atPoint point: CGPoint, forPage page: CPDFPage) {
|
|
|
+
|
|
|
+ override func PDFListViewPerformCancelMedia(_ pdfView: CPDFListView, atPoint point: CGPoint, forPage page: CPDFPage) {
|
|
|
CPDFMediaManager.sharedManager.mediaState = .stop
|
|
|
}
|
|
|
|
|
|
- func PDFListViewPerformRecordMedia(_ pdfView: CPDFListView, atPoint point: CGPoint, forPage page: CPDFPage) {
|
|
|
+ override func PDFListViewPerformRecordMedia(_ pdfView: CPDFListView, atPoint point: CGPoint, forPage page: CPDFPage) {
|
|
|
if self.soundPlayBar != nil && self.soundPlayBar?.superview != nil {
|
|
|
if self.soundPlayBar?.soundState == .play {
|
|
|
self.soundPlayBar?.stopAudioPlay()
|
|
@@ -939,7 +929,7 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
- func PDFListViewPerformPlay(_ pdfView: CPDFListView, forAnnotation annotation: CPDFSoundAnnotation) {
|
|
|
+ override func PDFListViewPerformPlay(_ pdfView: CPDFListView, forAnnotation annotation: CPDFSoundAnnotation) {
|
|
|
if let filePath = annotation.mediaPath() {
|
|
|
let URL = URL(fileURLWithPath: filePath)
|
|
|
|
|
@@ -954,7 +944,7 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func PDFListViewPerformSignatureWidget(_ pdfView: CPDFListView, forAnnotation annotation: CPDFSignatureWidgetAnnotation) {
|
|
|
+ override func PDFListViewPerformSignatureWidget(_ pdfView: CPDFListView, forAnnotation annotation: CPDFSignatureWidgetAnnotation) {
|
|
|
if self.pdfListView?.toolModel == .annotation {
|
|
|
self.annotationBar?.openSignatureAnnotation(annotation)
|
|
|
} else if self.pdfListView?.toolModel == .viewer {
|
|
@@ -984,7 +974,7 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func PDFListViewEditProperties(_ pdfListView: CPDFListView, forAnnotation annotation: CPDFAnnotation) {
|
|
|
+ override func PDFListViewEditProperties(_ pdfListView: CPDFListView, forAnnotation annotation: CPDFAnnotation) {
|
|
|
if self.pdfListView?.toolModel == .annotation {
|
|
|
self.annotationBar?.buttonItemClicked_openAnnotation(self.titleButton)
|
|
|
} else if self.pdfListView?.toolModel == .form {
|
|
@@ -992,7 +982,7 @@ class CPDFViewController: CPDFViewBaseController,CPDFFormBarDelegate,CPDFSoundPl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func PDFListViewContentEditProperty(_ pdfListView: CPDFListView, point: CGPoint) {
|
|
|
+ override func PDFListViewContentEditProperty(_ pdfListView: CPDFListView, point: CGPoint) {
|
|
|
if pdfListView.editingArea() is CPDFEditImageArea {
|
|
|
self.editMode = .image
|
|
|
} else if pdfListView.editingArea() is CPDFEditTextArea {
|