|
@@ -8,29 +8,29 @@
|
|
|
import Cocoa
|
|
|
|
|
|
enum KMWatermarkKey: String {
|
|
|
- case text = "text"
|
|
|
- case textFontSize = "textFontSize"
|
|
|
+ case text = "WatermarTextKey"
|
|
|
+ case textFontSize = "WatermarkOfTextFontSizeKey"
|
|
|
case textFontName = "textFontName"
|
|
|
- case imagePath = "imagePath"
|
|
|
- case rotate = "rotate"
|
|
|
- case opacity = "opacity"
|
|
|
- case scale = "scale"
|
|
|
- case verticalMode = "verticalMode"
|
|
|
- case verticalSpace = "verticalSpace"
|
|
|
- case horizontalMode = "horizontalMode"
|
|
|
- case horizontalSpace = "horizontalSpace"
|
|
|
- case isFront = "isFront"
|
|
|
- case red = "red"
|
|
|
- case green = "green"
|
|
|
- case blue = "blue"
|
|
|
- case createDate = "createDate"
|
|
|
- case pageRangeType = "pageRangeType"
|
|
|
- case pageRangeString = "pageRangeString"
|
|
|
- case tileVerticalSpace = "tileVerticalSpace"
|
|
|
- case tileHorizontalSpace = "tileHorizontalSpace"
|
|
|
- case isTile = "isTile"
|
|
|
- case lastAddData = "lastAddData"
|
|
|
- case id = "id"
|
|
|
+ case imagePath = "WatermarkOfImagePathKey"
|
|
|
+ case rotate = "WatermarkOfRotationKey"
|
|
|
+ case opacity = "WatermarkOfOpacityKey"
|
|
|
+ case scale = "WatermarkOfScaleKey"
|
|
|
+ case verticalMode = "WatermarkOfVerticalModeKey"
|
|
|
+ case verticalSpace = "WatermarkOfVerticalSpaceKey"
|
|
|
+ case horizontalMode = "WatermarkOfHorizontalModeKey"
|
|
|
+ case horizontalSpace = "WatermarkOfHorizontalSpaceKey"
|
|
|
+ case isFront = "WatermarkOfIsFrontKey"
|
|
|
+ case red = "WatermarkOfRedKey"
|
|
|
+ case green = "WatermarkOfGreenKey"
|
|
|
+ case blue = "WatermarkOfBlueKey"
|
|
|
+ case createDate = "WatermarkOfCreatTemplateDateKey"
|
|
|
+ case pageRangeType = "WatermarkOfPageRangeTypeKey"
|
|
|
+ case pageRangeString = "WatermarkOfPageStringKey"
|
|
|
+ case tileVerticalSpace = "WatermarkTileVerticalSpaceKey"
|
|
|
+ case tileHorizontalSpace = "WatermarkTileHorizontalSpaceKey"
|
|
|
+ case isTile = "WatermarkOfIsTileKey"
|
|
|
+ case lastAddData = "kAddLastWatermarkDataKey1"
|
|
|
+ case id = "kWatermarkIDKey"
|
|
|
}
|
|
|
|
|
|
class KMWatermarkManager: NSObject {
|
|
@@ -384,8 +384,8 @@ class KMWatermarkManager: NSObject {
|
|
|
if (isText) {
|
|
|
model.text = (dict.object(forKey: KMWatermarkKey.text.rawValue) as! String)
|
|
|
let fontSize: CGFloat = dict.object(forKey: KMWatermarkKey.textFontSize.rawValue) as! CGFloat
|
|
|
- let fontName: String = dict.object(forKey: KMWatermarkKey.textFontName.rawValue) as! String
|
|
|
- model.textFont = .font(name: fontName, size: fontSize)
|
|
|
+// let fontName: String = dict.object(forKey: KMWatermarkKey.textFontName.rawValue) as! String
|
|
|
+ model.textFont = .font(name: "Helvetica", size: fontSize)
|
|
|
} else if (isFile) {
|
|
|
let path = watermarkFolderPath?.stringByAppendingPathComponent(dict.object(forKey: KMWatermarkKey.imagePath.rawValue) as! String)
|
|
|
if (FileManager.default.fileExists(atPath: path!)) {
|
|
@@ -407,7 +407,7 @@ class KMWatermarkManager: NSObject {
|
|
|
let green: CGFloat = dict.object(forKey: KMWatermarkKey.green.rawValue) as? CGFloat ?? 0
|
|
|
let blue: CGFloat = dict.object(forKey: KMWatermarkKey.blue.rawValue) as? CGFloat ?? 0
|
|
|
model.textColor = .color(red: red, green: green, blue: blue, alpha: 1.0)
|
|
|
- model.isFront = (dict.object(forKey: KMWatermarkKey.isFront.rawValue) != nil)
|
|
|
+ model.isFront = (dict.object(forKey: KMWatermarkKey.isFront.rawValue) as? Bool) ?? false
|
|
|
model.pageRangeType = KMWatermarkeModelPageRangeType.init(rawValue: (dict.object(forKey: KMWatermarkKey.pageRangeType.rawValue) as? Int) ?? 0)!
|
|
|
model.pagesString = (dict.object(forKey: KMWatermarkKey.pageRangeString.rawValue) as? String ?? "")
|
|
|
model.isTilePage = (dict.object(forKey: KMWatermarkKey.isTile.rawValue) as? Bool) ?? false
|