How to Programmatically Use the AirPrint API for Single-Side Printing in iOS 17

Hey, fellow iOS developers! I'm working on an app for iOS 17 and need to implement single-side printing using the AirPrint API. I've done some research, but I'm still facing a few challenges. Can anyone provide guidance or share some sample code to achieve this?

I've already imported the UIKit and MobileCoreServices frameworks and have set up the basic AirPrint functionality. Now, I'm looking specifically for instructions and code to enable single-sided printing.

URL - https://www.controlf5.in/

Test code

`**import UIKit import MobileCoreServices

// Set up AirPrint functionality func printDocument() { let printController = UIPrintInteractionController.shared

let printInfo = UIPrintInfo(dictionary: nil)
printInfo.outputType = .general
printController.printInfo = printInfo

let formatter = UIMarkupTextPrintFormatter(markupText: "Your printable content goes here")
formatter.perPageContentInsets = UIEdgeInsets(top: 36, left: 36, bottom: 36, right: 36)
printController.printFormatter = formatter

printController.present(animated: true) { (controller, success, error) in
    if success {
        print("Printing completed successfully")
    } else if let error = error {
        print("Printing failed with error: \(error.localizedDescription)")
    }
}

}**`

Replies

That is most likey a private API and a user-controlled action.