In iPad print preview not showing UILabels. When I zoom in the print preview it showing properly. When I changed UILabel opaque
property to true
it will change the UILabel's background to black and display on print preview. This is the code I used to show print preview.
let printController = UIPrintInteractionController.shared
let printInfo = UIPrintInfo(dictionary:nil)
printInfo.outputType = UIPrintInfoOutputType.general
printInfo.jobName = "Print"
printInfo.duplex = UIPrintInfoDuplex.none
printInfo.orientation = UIPrintInfoOrientation.portrait
printController.printPageRenderer = nil
printController.printingItems = nil
printController.printingItem = printUrl
printController.printInfo = printInfo
printController.showsNumberOfCopies = true
printController.showsPaperSelectionForLoadedPapers = true
printController.present(animated: true, completionHandler: nil)
When I change UIPrintInfoOutputType.general
to UIPrintInfoOutputType.grayscale
it will display the UILabels, but I need color print. Grayscale is only for black & white printing.