I am building an app that uses a bunch of text fields to let the user fill in at a doctors office. They will then hit a print button to print the pdf like page that has been filled out by the user. The problem I am having is that with the code for printing that I have it shows it as a blank document.
@IBAction func printBtnPressed(_ sender: Any) {
let pInfo = UIPrintInfo(dictionary:nil)
pInfo.outputType = UIPrintInfoOutputType.general
pInfo.jobName = "Print Patient Forms"
//Set up print controller
let printController = UIPrintInteractionController.shared
printController.printInfo = pInfo
//Assign a UIMage version of my UIView as a printing Item
printController.printingItem = self.view
//var pInfo : UIPrintInfo = UIPrintInfo.printInfo()
pInfo.orientation = UIPrintInfoOrientation.portrait
let formatter = UIMarkupTextPrintFormatter(markupText: textView.text!)
printController.showsNumberOfCopies = false
printController.showsPageRange = true
printController.printFormatter = pdfView.viewPrintFormatter()
printController.present(animated: true, completionHandler: nil)
}
Anyone have any suggestions?