Home > Uncategorized > Print an Image using #Xamarin.mac

Print an Image using #Xamarin.mac

Printing an image using Xamarin turned out to be much easier than I thought, I loaded the image from a URL into an NSImageCell using;

                string strUrl = “http;// Some Url with an image; // ?
                NSUrl url = new NSUrl (strUrl);
                this.imgCell.Image = new NSImage (url);

Then to print it, I used the command;

    partial void printButton (Foundation.NSObject sender) {
            NSPrintOperation p = NSPrintOperation.FromView(this.imgCell.ControlView);
            p.RunOperation();
        }

Really surprised how easy that turned out to be!

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: