Forum Xamarin.Mac

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

how to print an image using NSPrintOperation?

Hi,

I am trying to print an image which is NSImage. I am using NSPrintOperation but page is always blank. I am not sure what I am missing. please have a look at below code

NSView nSImageView = NSImageView.FromImage(badgeImage);
NSPrintOperation printOperation = NSPrintOperation.FromView(nSImageView,NSPrintInfo.SharedPrintInfo);
printOperation.JobTitle= $"Print badge : {documentName}";
printOperation.ShowsPrintPanel = true;
printOperation.RunOperation();

Note- documentName is a string. badgeImage is a NSImage object

Sign In or Register to comment.