// // KMPDFViewManager.swift // PDF Reader Pro // // Created by Niehaoyu on 2024/10/22. // import Foundation class KMPDFViewManager: NSObject { var viewToolsType: KMPDFViewToolsType = .Select //ToolsView类型 var toolMode: KMPDFToolsMode = .None //一级工具栏 var subToolMode: KMPDFSubToolMode = .None //二级工具栏 //侧边栏样式 var pdfSideBarType: KMPDFSidebarType = .none { didSet { UserDefaults.standard.setValue(pdfSideBarType.rawValue, forKey: "KMPDFSidebarTypeKey") } } var showDisplayView: Bool = false //显示左侧View界面 var showRightSide: Bool = false //显示右侧界面 var isPageEditMode: Bool = false //页面编辑模式 var isPDFReadMode: Bool = false //阅读模式 var editType: KMPDFEditModeType = .none //分屏PDF var splitPDFFileURL: URL? var splitPDFFilePassword: String? var splitSyncScroll: Bool = true var splitShowBottomBar: Bool = true override init() { super.init() self.initData() } func initData() { } } //MARK: - Annotation注释 extension KMPDFViewManager { class func getValidPDFAnnotationType(_ subToolMode: KMPDFSubToolMode?) -> CAnnotationType { if subToolMode == .Highlight { return .highlight } else if subToolMode == .Underline { return .underline } else if subToolMode == .Waveline { return .squiggly } else if subToolMode == .Strikethrough { return .strikeOut } else if subToolMode == .Text { return .freeText } else if subToolMode == .Note { return .anchored } else if subToolMode == .Pen { return .ink } else if subToolMode == .Eraser { return .eraser } else if subToolMode == .Rectangle { return .square } else if subToolMode == .Circle { return .circle } else if subToolMode == .Arrow { return .arrow } else if subToolMode == .Line { return .line } else if subToolMode == .Measure { } else if subToolMode == .Stamp { } else if subToolMode == .Sign { } return .unkown } }