قالب وردپرس درنا توس
Home / IOS Development / ios – Print a WebView content on two-sided (front and back) printers with different front and back margins

ios – Print a WebView content on two-sided (front and back) printers with different front and back margins



I have a WebView and want to print it is HTML content via AirPrint. I want to add custom page margins to this content. I was able to achieve it using my own subclass of UIPrintPageRenderer

Now, when my app user uses the duplex printer (print on the front and back of the page), I will specify different page margins for the front and back pages.

UIPrintPageRenderer was unable to accomplish this task since it requests headerHeight footerHeight as a single property and it has nothing like headerHeight (front page :)

] I've also researched the ability to create PDF, but apparently, PDF files are generated only with UIPrintPageRenderer.

I also don't know how to override or get customized UIViewPrintFormatter from WKWebView, since this object is returned by WebView's function func viewPrintFormatter () -> UIViewPrintFormatter


Source link