I'm working with Swift 4 for macOS and I can load a HTML string into my web view and print this with my code:
let printInfo = NSPrintInfo.shared
printInfo.isHorizontallyCentered = true
printInfo.isVerticallyCentered = true
printInfo.orientation = .portrait
printInfo.topMargin = 0
printInfo.rightMargin = 0
printInfo.bottomMargin = 50
printInfo.leftMargin = 0
printInfo.verticalPagination = .autoPagination
let printOp = NSPrintOperation(view: sender.mainFrame.frameView.documentView, printInfo: printInfo)
printOp.run()
Is it possible to apply different printInfo settings only for the first page?
For example: The first page should have topMargin = 50 and all other pages should have 0. Is this possible?
You can only set those values for the whole document and not for individual pages. If you want to set up different margins for a specific page, you'll have to modify the document directly.