// Don't forget to Dispose ImagXpress void Dispose() { if (!(imagXpress1 == null)) { imagXpress1.Dispose(); imagXpress1 = null; } if (!(imagProcessor == null)) { imagProcessor.Dispose(); imagProcessor = null; } if (!(imagX1 == null)) { imagX1.Dispose(); imagX1 = null; } }
public UnlockIXandProcessImg() { try { imagXpress1 = new Accusoft.ImagXpressSdk.ImagXpress(); //***The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey methods must be called to distribute the runtime*** //imagXpress1.Licensing.SetSolutionName("YourSolutionName"); //imagXpress1.Licensing.SetSolutionKey(12345,12345,12345,12345); //imagXpress1.Licensing.SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation�"); //System.Console.WriteLine("ImagXpress successfully licensed."); imagProcessor = new Accusoft.ImagXpressSdk.Processor(imagXpress1); soSaveOptions = new Accusoft.ImagXpressSdk.SaveOptions(); soSaveOptions.Format = ImageXFormat.Tiff; soSaveOptions.Tiff.Compression = Compression.Group4; sInputFileName = System.IO.Path.Combine(strCurrentDir, @"..\..\..\..\..\..\..\..\..\..\Common\Images\Benefits.tif"); sOutputFileName = (strCurrentDir + "\\BenefitsRotated.tif"); imagX1 = Accusoft.ImagXpressSdk.ImageX.FromFile(imagXpress1, sInputFileName); imagProcessor.Image = imagX1; imagProcessor.Rotate(180); imagX1 = imagProcessor.Image; imagX1.Save(sOutputFileName, soSaveOptions); Dispose(); System.Console.WriteLine(("Rotated TIFF saved to file " + sOutputFileName)); System.Console.ReadLine(); } catch (Accusoft.ImagXpressSdk.ImagXpressException ex) { Dispose(); System.Console.WriteLine(ex.Message); System.Console.WriteLine(ex.Source); System.Console.ReadLine(); } catch (System.Exception ex) { Dispose(); System.Console.WriteLine(ex.Message); System.Console.WriteLine(ex.Source); System.Console.ReadLine(); } }