Print one scrollview without bottom view in swift
Problem:
I want to print the content of scrollview. But end of scroll view my print button is there.I want to print without that button.How to achieve that.
Solution:
It's possible.You first hide the button after click print then generate the pdf.After generation of pdf show the button.It will works perfectly.
func printContent() {
let printInfo = UIPrintInfo(dictionary: nil)
printInfo.jobName = scrollView.description
printInfo.outputType = .general
self.scrollView.subviews.last.ishidden = true
let path = self.scrollView.exportAsPdfFromVi
self.scrollView.subviews.last.ishidden = false
let printController = UIPrintInteractionController.s
printController.printInfo = printInfo
printController.printingItem = NSURL(fileURLWithPath:path)
printController.present(
}
Comments
Post a Comment