1

I have set the following code:

let printInfo = NSPrintInfo.sharedPrintInfo
let textPrint = NSPrintOperation(view: theTextView,printInfo: printInfo())

Now I would like to set the orientation to Landscape, but I can't find any Swift functions that do this.

4

2 回答 2

2

这就是我正在使用的。NSView 称为绘图。

let pinfo = NSPrintInfo.shared()
pinfo.orientation = .landscape
pinfo.bottomMargin = 0.0
pinfo.topMargin = 0.0
pinfo.leftMargin = 0.0
pinfo.rightMargin = 0.0
drawing!.print(self)
于 2017-07-25T00:34:13.507 回答
0

尝试这个:

let pmPageFormat = printInfo.PMPageFormat()
PMSetOrientation(pmPageFormat, kPMLandscape, kPMUnlocked)
printInfo.updateFromPMPageFormat()
于 2015-08-12T17:34:30.073 回答