Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Images not getting displayed in the print preview of iOS

$
0
0

I have dynamically created a html page with both text and images. When assigned to web-view source, the webview displays the text as well as the images. The images are stored in the iOS bundle i.e. at the root folder of iOS project.
When the same webview content is passed for printing the UIPrintInteractionController class only displays the text and not the images in the print preview.

Code written for printing:-
var appleViewToPrint = Platform.CreateRenderer(WebViewToPrint).NativeView;
var printInfo = UIPrintInfo.PrintInfo;
printInfo.OutputType = UIPrintInfoOutputType.General;
if(string.IsNullOrEmpty(fileName))
fileName = "Form Print";
printInfo.JobName = fileName;
printInfo.Orientation = UIPrintInfoOrientation.Portrait;
printInfo.Duplex = UIPrintInfoDuplex.None;

            UIPrintInteractionController printController = UIPrintInteractionController.SharedPrintController;

            printController.PrintInfo = printInfo;
            printController.ShowsPageRange = true;
            printController.PrintPageRenderer = new UIPrintPageRenderer()
            {
                HeaderHeight = 40,
                FooterHeight = 40
            };
            printController.PrintPageRenderer.AddPrintFormatter(appleViewToPrint.ViewPrintFormatter, 0);

            if (Device.Idiom == TargetIdiom.Phone)
            {
                printController.PresentAsync(true);
            }
            else if (Device.Idiom == TargetIdiom.Tablet)
            {
                printController.PresentFromRectInViewAsync(new CGRect(200, 200, 0, 0), appleViewToPrint, true);
            }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>