I am trying to print webview content to airprinter. Everything works fine except I am not getting page breaks. I have searched in many forums but I didn't found the solution.
This is my HTML Template
<html><body>
<h1 style='display:block; page-break-after:always;'>PAGE 1</h1>
<h1 style='display:block; page-break-after:always;'>PAGE 2</h1>
<h1 style='display:block; page-break-after:always;'>PAGE 3</h1>
</body></html>
Webview is showing page break properly.
But when Printing function is called I am getting this
@IBAction func printDoc(_ sender: Any) {
let pic = UIPrintInteractionController.shared
let printInfo : UIPrintInfo = UIPrintInfo(dictionary: nil)
printInfo.outputType = UIPrintInfoOutputType.general
printInfo.jobName = "test"
pic.printInfo = printInfo
pic.printFormatter = webview.viewPrintFormatter()
pic.showsPageRange = false
pic.present(animated: true, completionHandler: nil)
}
Please tell me how to have page break when printing to air printer.