Unable to print 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

Tagged:
Sign In or Register to comment.