KMPrintDrawPage.swift 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // KMPrintDrawPage.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lizhe on 2023/2/13.
  6. //
  7. import Cocoa
  8. //typealias KMPrintDrawPageBlock = (_ box: CPDFDisplayBox, _ context: CGContext, _ pages: [KMPrintDrawPage]) -> Void
  9. typealias KMPrintDrawPageBlock = (_ box: PDFDisplayBox, _ context: CGContext, _ pages: [KMPrintDrawPage]) -> Void
  10. class KMPrintDrawPage: PDFPage {
  11. // var page: CPDFPage = CPDFPage()
  12. var page: PDFPage = PDFPage()
  13. var pages: [KMPrintDrawPage] = []
  14. var cropRect: CGRect = NSZeroRect
  15. var showRect: CGRect = NSZeroRect
  16. var point: CGPoint = NSMakePoint(1, 1)
  17. var drawPageBlock: KMPrintDrawPageBlock?
  18. override func draw(with box: PDFDisplayBox, to context: CGContext) {
  19. super.draw(with: box, to: context)
  20. self.drawPageBlock?(box, context, pages)
  21. }
  22. // override func draw(with box: CPDFDisplayBox, to context: CGContext!) {
  23. // super.draw(with: box, to: context)
  24. //
  25. // self.drawPageBlock?(box, context, pages)
  26. // }
  27. }