소스 검색

【裁剪】- 裁剪区域打印

liaoxiaoyue 1 년 전
부모
커밋
f7dd7ebbf4
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      PDF Office/PDF Office/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

+ 5 - 3
PDF Office/PDF Office/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -473,9 +473,11 @@ extension KMMainViewController {
         let page = listView.currentPage()
         let copyPage : CPDFPage = page!.copy() as! CPDFPage
         copyPage.setBounds(rect, for: .cropBox)
-        let pdfDocument : CPDFDocument = CPDFDocument()
-        pdfDocument.insertPageObject(copyPage, at: 0)
-        
+        let image : NSImage = copyPage.thumbnail(of:(copyPage.bounds(for: .cropBox)).size)
+        let pdfDocument : PDFDocument = PDFDocument()
+        let newpage : PDFPage = PDFPage(image: image)!
+        pdfDocument.insert(newpage, at: 0)
+        KMPrintWindowController.openPrintView(document: pdfDocument)
         KMPrintWindowController.openDocument(inputDocument: self.listView?.document, inputPageRange: KMPrintPageRange(type: .allPage, selectPages: []))
     }