I'm trying to crop and print my image using the following code I found on the forums but some of the code/methods are not there. I don't want to just call WebImageViewer.print() because the image isn't scaling/fitting on a 8.5X11 page.
I"m using version 5.0
ViewPortSize is not on the WebImageViewer
ApplyToImage is obsolete
AtalaImage
myPrintImage = WebImageViewerMain.Image;
Point myPos = new Point(-(int)Math.Round(WebImageViewerMain.ImagePosition.X / WebImageViewerMain.Zoom), -(int)Math.Round(WebImageViewerMain.ImagePosition.Y / WebImageViewerMain.Zoom));
Size mySize = new Size((int)Math.Round(WebImageViewerMain.ViewPortSize.Width / WebImageViewerMain.Zoom), (int)Math.Round(WebImageViewerMain.ViewPortSize.Height / WebImageViewerMain.Zoom));
CropCommand myCrop = new CropCommand(new Rectangle(myPos, mySize));
// Crop Image to viewport size
myPrintImage = myCrop.ApplyToImage(myPrintImage);
// Resample Image at lower scale
Size cropResamp = WebImageViewerMain.Size;
ResampleCommand myResamp = new ResampleCommand(cropResamp);
myPrintImage = myResamp.ApplyToImage(myPrintImage);
// Save Image to the Cache using SessionID
myPrintImage.Save(Page.MapPath(WebImageViewerMain.CachePath) +
this.Session.SessionID + ".jpg", new JpegEncoder(90, 0, false), null);
string tempPrint = WebImageViewerMain.CachePath + this.Session.SessionID + ".jpg";
string commandtext = "<Script Languauge='JavaScript'>";
commandtext = commandtext +
"window.open('" + tempPrint + "','PrintImage');";
commandtext = commandtext +
"</script>";
Response.Write(commandtext);