KMPrintPrinterModel.swift 969 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // KMPrintPrinterModel.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lizhe on 2022/12/21.
  6. //
  7. import Cocoa
  8. struct KMPrintPrinterModelOptions: OptionSet {
  9. let rawValue: Int
  10. static let none = KMPrintPrinterModelOptions(rawValue: 1 << 0) //无
  11. static let blackAndWhite = KMPrintPrinterModelOptions(rawValue: 1 << 1) //黑白色
  12. static let printOnBothSides = KMPrintPrinterModelOptions(rawValue: 1 << 2) //双面打印
  13. static let all: KMPrintPrinterModelOptions = [.blackAndWhite, .printOnBothSides]
  14. }
  15. enum KMPrintPrinterOnBothSidesType: String, CaseIterable {
  16. case long = "Flip on long edge"
  17. case short = "Flip on short edge"
  18. }
  19. class KMPrintPrinterModel: NSObject {
  20. var name: String = NSPrinter.printerNames.first ?? "无打印机" //打印机名称
  21. var copies: Int = 1 //份数
  22. var options: KMPrintPrinterModelOptions = .none //打印类型
  23. var onBothSidesType: KMPrintPrinterOnBothSidesType = .long //双面类型
  24. }