Color preview does not display UILabels

The press for printing on the iPad does not display UILabels. When I increase the print preview, it displays correctly. When I changed the UILabel property opaqueto true, it will change the background of the UILabel to black and display it in preview. This is the code I used to show the 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.generalto UIPrintInfoOutputType.grayscale, it displays UILabels, but I need color printing. Grayscale for black and white printing only. A.

+4
source share
1 answer

, , , .

opaque UILabel true, UILabel . , UILabel Default. , UILabel . UILabel , . ​​

printLabel.isOpaque = true
printLabel.backgroundColor = UIColor.white //Not Default or Clear Color
0

Source: https://habr.com/ru/post/1680044/


All Articles