KMPDFWatermarkData.swift 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // KMPDFWatermarkData.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2023/11/2.
  6. //
  7. import Cocoa
  8. enum WatermarkPageRangeType: Int {
  9. case all = 0
  10. case odd
  11. case even
  12. case other
  13. }
  14. @objcMembers class KMPDFWatermarkData: NSObject {
  15. var text: String = NSLocalizedString("Watermark", comment: "")
  16. var image: NSImage?
  17. var imagePath: String?
  18. var textFontSize: CGFloat = 48
  19. var textColor: NSColor = NSColor.red
  20. var rotation: Int = 0
  21. var opacity: CGFloat = 1
  22. var scale: CGFloat = 1
  23. // (Top:0 Middle:1 Bottom:2)
  24. var verticalMode: Int = 1
  25. var verticalSpace: Int = 0
  26. // (Left:0 Middle:1 Right:2)
  27. var horizontalMode: Int = 1
  28. var horizontalSpace: Int = 0
  29. var tileHorizontalSpace: Int = 100
  30. var tileVerticalSpace: Int = 100
  31. var pagesString: String = ""
  32. var isFront: Bool = true
  33. var isTilePage = false
  34. var tag: String?
  35. var pageRangeType: WatermarkPageRangeType = .all
  36. var creatTemplateDate: String?
  37. var watermark: CPDFWatermark?
  38. var watermarkID: String = KMWatermarkManager.defaultManager.fetchAvailableName()
  39. override func copy() -> Any {
  40. let watermark = KMPDFWatermarkData()
  41. watermark.text = self.text
  42. watermark.image = self.image
  43. watermark.textFontSize = self.textFontSize
  44. watermark.textColor = self.textColor
  45. watermark.rotation = self.rotation
  46. watermark.opacity = self.opacity
  47. watermark.scale = self.scale
  48. watermark.verticalMode = self.verticalMode
  49. watermark.verticalSpace = self.verticalSpace
  50. watermark.horizontalMode = self.horizontalMode
  51. watermark.horizontalSpace = self.horizontalSpace
  52. watermark.pagesString = self.pagesString
  53. watermark.isFront = self.isFront
  54. watermark.watermarkID = self.watermarkID
  55. watermark.tag = self.tag
  56. watermark.pageRangeType = self.pageRangeType
  57. watermark.imagePath = self.imagePath
  58. watermark.tileVerticalSpace = self.tileVerticalSpace
  59. watermark.tileHorizontalSpace = self.tileHorizontalSpace
  60. watermark.isTilePage = self.isTilePage
  61. return watermark
  62. }
  63. }