// // KMEditDocumentController.swift // PDF Reader Pro // // Created by Niehaoyu on 2024/11/1. // import Cocoa class KMEditDocumentController: NSViewController { var pdfDocument: CPDFDocument? var pdfView: CPDFListView = CPDFListView.init() let coverView = NSView(frame: CGRectMake(0, 0, 300, 300)) override func viewDidLoad() { super.viewDidLoad() // Do view setup here. pdfView.frame = view.bounds pdfView.autoresizingMask = [.width, .height] pdfView.setDisplay(.singlePage) pdfView.autoScales = true view.addSubview(pdfView) } func reloadData() { guard let pdfDocument = self.pdfDocument else { return } pdfView.document = pdfDocument } func refreshUI() { pdfView.updateRender(true) } func layoutDocumentView() { pdfView.document?.refreshPageData() pdfView.layoutDocumentView() } }