|
@@ -336,7 +336,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
|
|
|
let paperSize: CGSize = self.fetchPaperSize(data.paper)//纸张大小
|
|
|
let paperItemSize: CGSize = self.fetchPaperItemSize(data.paper) //页面paper大小(去除边框)
|
|
|
let paperInset: NSEdgeInsets = data.paper.info.inset //绘制paper大小
|
|
|
- let border: Bool = true //是否存在边框
|
|
|
+ let border: Bool = data.page.operation.multipage.isBorder //是否存在边框
|
|
|
|
|
|
/**
|
|
|
page
|
|
@@ -349,7 +349,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
|
|
|
|
|
|
//行列
|
|
|
let columnAndRow = self.fetchPageColumnAndRow(data.page) //行 列数量
|
|
|
- let columnAndRowSpace = CGPoint(x: 2, y: 2) //行 列之间的空间
|
|
|
+ let columnAndRowSpace = CGPoint(x: data.page.operation.multipage.lineSpacing, y: data.page.operation.multipage.columnsSpacing) //行 列之间的空间
|
|
|
|
|
|
for i in 0..<Int(columnAndRow.x) {
|
|
|
for j in 0..<(Int(columnAndRow.y)) {
|
|
@@ -413,21 +413,18 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
|
|
|
page.page.transform(context, for: PDFDisplayBox.cropBox)
|
|
|
if border {
|
|
|
var dirtyRect = rect
|
|
|
+ //CGRectMake(origin.x, origin.y, 100, 100)
|
|
|
if rotate == 90 ||
|
|
|
rotate == 270 {
|
|
|
dirtyRect = NSMakeRect(dirtyRect.origin.x, dirtyRect.origin.y, dirtyRect.size.height, dirtyRect.size.width)
|
|
|
}
|
|
|
|
|
|
context.addRect(dirtyRect)
|
|
|
- context.setStrokeColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
|
|
|
+ context.setStrokeColor(red: 0, green: 0, blue: 0, alpha: 1.0)
|
|
|
context.strokePath()
|
|
|
}
|
|
|
NSGraphicsContext.restoreGraphicsState()
|
|
|
// page.setBounds(NSRect(x: 0, y: 0, width: pageRect.size.width, height: pageRect.size.height), for: .cropBox)
|
|
|
- print("--------------------------")
|
|
|
- print(page.page)
|
|
|
- print(origin)
|
|
|
- print(scale)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -647,11 +644,18 @@ extension KMPrintPresenter: KMPrintPresenterPage {
|
|
|
func fetchPageItemSize(_ pageModel: KMPrintPageModel, _ paperSize: CGSize) -> CGSize {
|
|
|
var size = NSZeroSize
|
|
|
let columnAndRow = self.fetchPageColumnAndRow(pageModel) //行 列数量
|
|
|
- let columnAndRowSpace = CGPoint(x: 2, y: 2) //行 列之间的空间
|
|
|
+ let lineSpacing = pageModel.operation.multipage.lineSpacing
|
|
|
+ let columnsSpacing = pageModel.operation.multipage.columnsSpacing
|
|
|
+ let columnAndRowSpace = CGPoint(x: lineSpacing, y: columnsSpacing) //行 列之间的空间
|
|
|
|
|
|
//page大小
|
|
|
- size = CGSize(width: (paperSize.width - CGFloat((columnAndRow.x - 1)) * CGFloat(columnAndRowSpace.x)) / columnAndRow.x,
|
|
|
- height: (paperSize.height - CGFloat((columnAndRow.y - 1)) * CGFloat(columnAndRowSpace.y)) / columnAndRow.y)
|
|
|
+ if pageModel.operation.type == .multipage {
|
|
|
+ size = CGSize(width: (paperSize.width - CGFloat((columnAndRow.x - 1)) * CGFloat(columnAndRowSpace.x)) / columnAndRow.x,
|
|
|
+ height: (paperSize.height - CGFloat((columnAndRow.y - 1)) * CGFloat(columnAndRowSpace.y)) / columnAndRow.y)
|
|
|
+ } else {
|
|
|
+ size = CGSize(width: (paperSize.width - CGFloat((columnAndRow.x - 1)) * CGFloat(columnAndRowSpace.x)) / columnAndRow.x,
|
|
|
+ height: (paperSize.height - CGFloat((columnAndRow.y - 1)) * CGFloat(columnAndRowSpace.y)) / columnAndRow.y)
|
|
|
+ }
|
|
|
return size
|
|
|
}
|
|
|
|