Post

Replies

Boosts

Views

Activity

Reply to Swift Cocoa: PrintOperation() with Sonoma does not work
ChatGPt found the problem today, this code is working: func createPrintOperation() { let printOpts: [NSPrintInfo.AttributeKey: Any] = [.headerAndFooter: false,.orientation : 1] // set let printInfo = NSPrintInfo(dictionary: printOpts) printInfo.leftMargin = 0 printInfo.rightMargin = 0 printInfo.topMargin = 0 printInfo.bottomMargin = 0 printInfo.horizontalPagination = .fit printInfo.verticalPagination = .automatic printInfo.isHorizontallyCentered = true printInfo.isVerticallyCentered = true printInfo.scalingFactor = 1.0 printInfo.paperSize = NSMakeSize(612, 792) // letter printInfo.orientation = .portrait let printOperation = NSPrintOperation(view: PrintView, printInfo: printInfo) // Attempt to show paper size and orientation options printOperation.printPanel.options.insert(.showsPaperSize) printOperation.printPanel.options.insert(.showsOrientation) // Set the job title let jobTitle = fact.nom_complet_f.replacingOccurrences(of: " ", with: "") printOperation.jobTitle = jobTitle // Ensure the print operation runs on the main thread DispatchQueue.main.async { printOperation.run() }
Oct ’24
Reply to Access Objects In View Controller From Window Controller
This is what is working for me :  var viewController: ViewController {         get {             return self.window!.contentViewController! as! ViewController         }     } ... viewController.cwHello.color = cptHello.colr
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Arkit 4.0 and Body measurement
I am also interested!
Topic: Spatial Computing SubTopic: ARKit Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Swift Cocoa: PrintOperation() with Sonoma does not work
ChatGPt found the problem today, this code is working: func createPrintOperation() { let printOpts: [NSPrintInfo.AttributeKey: Any] = [.headerAndFooter: false,.orientation : 1] // set let printInfo = NSPrintInfo(dictionary: printOpts) printInfo.leftMargin = 0 printInfo.rightMargin = 0 printInfo.topMargin = 0 printInfo.bottomMargin = 0 printInfo.horizontalPagination = .fit printInfo.verticalPagination = .automatic printInfo.isHorizontallyCentered = true printInfo.isVerticallyCentered = true printInfo.scalingFactor = 1.0 printInfo.paperSize = NSMakeSize(612, 792) // letter printInfo.orientation = .portrait let printOperation = NSPrintOperation(view: PrintView, printInfo: printInfo) // Attempt to show paper size and orientation options printOperation.printPanel.options.insert(.showsPaperSize) printOperation.printPanel.options.insert(.showsOrientation) // Set the job title let jobTitle = fact.nom_complet_f.replacingOccurrences(of: " ", with: "") printOperation.jobTitle = jobTitle // Ensure the print operation runs on the main thread DispatchQueue.main.async { printOperation.run() }
Replies
Boosts
Views
Activity
Oct ’24