For printing from employee thread to a UIPrinter(whose url i’ve saved ) i’m doing this and in a position to print :
func PrintPdfDocument (pDocument:Information)
{
// Create a print interplay controller
let printController = UIPrintInteractionController.shared
// Set the printing choices
let printInfo = UIPrintInfo(dictionary:nil)
printInfo.jobName = "Print Job "
printController.printInfo = printInfo
printController.showsPageRange = true
// Set the PDF doc to be printed
printController.printingItems = pDocument
printController.print(to: defaulttprinter, completionHandler: { (controller, accomplished, error) in
if accomplished {
print("Printing profitable!")
} else {
if let error = error {
print("Printing failed with error: (error.localizedDescription)")
} else {
print("Printing was canceled.")
}
}
})
}
When i name PrintPdfDocument (pDocument:Information) operate , greater than as soon as with diffrent information proven under :
DispatchQueue.international().async {
PrintPdfDocument (pDocument:data1)
}
DispatchQueue.international().async {
PrintPdfDocument (pDocument:data2)
}
DispatchQueue.international().async {
PrintPdfDocument (pDocument:data3)
}
Printer is printing just one doc(data1) . For others(data2,data3) name shouldn’t be executing printController.print (to….) operate inside PrintPdfDocument.