Wednesday, March 22, 2023
HomeiOS Developmentswift - get the record of all of the printer related...

swift – get the record of all of the printer related to ios machine programmatically?


I wish to print paperwork utilizing UIPrintIntrectionController() and must cross one of many out there printer however i’ve to cross the printer programmatically as an alternative of hardcoding the main points of printer

i attempted utilizing NetServiceBrower() however it’s depreceted and assets usually are not out there about it

let printController = UIPrintInteractionController.shared
        
        let printInfo = UIPrintInfo(dictionary: nil)
        
        printInfo.jobName = "printing"
        
        printInfo.outputType = UIPrintInfo.OutputType.normal
        
        printController.printInfo = printInfo
        
        let str = "hi there"
        
        let dataStr: Knowledge = Knowledge(str.utf8)

        let knowledge = NSData(knowledge: dataStr)
        
        printController.printingItem = knowledge
        
        
        //must entry a  printer to cross to printerController
        let printer = ??
 
        printController.print(to: printer)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

5 × one =

Most Popular

Recent Comments