Given a URL, how can I print what is at that URL on iOS, without displaying a WKWebView (or WebView in XF)?
I find that if the URL is that of an asset such as a .png file then it works, but if it is that of a page then it doesn't.
I've tried a few ways, the simplest being:
if (Foundation.NSUrl.FromString(url) is Foundation.NSUrl nsUrl && nsUrl.Scheme != null) { UIKit.UIPrintInfo printInfo = UIKit.UIPrintInfo.PrintInfo; printInfo.JobName = printJobConfiguration.JobName; printInfo.Duplex = UIKit.UIPrintInfoDuplex.None; printInfo.OutputType = UIKit.UIPrintInfoOutputType.General; UIKit.UIPrintInteractionController printController = UIKit.UIPrintInteractionController.SharedPrintController; printController.ShowsPageRange = true; printController.ShowsPaperSelectionForLoadedPapers = true; printController.PrintInfo = printInfo; printController.PrintingItem = Foundation.NSData.FromUrl(nsUrl); printController.Present(true, (printInteractionController, completed, error) => { // error reporting goes here }); }
With the above implementation, the print preview that appears has the correct number of pages, but they are all blank.
I've also instantiated a new WKWebView, issued a LoadRequest and waited for EstimatedProgress to be 1.0, before printing the WKWebView. Again, that doesn't render the content. I am assuming because the WKWebView itself is not rendered on a page.
Any ideas how to do this without rendering the WKWebView on a page?