private bool InitClass() { if (RasterSupport.IsLocked(RasterSupportType.PrintDriver) && RasterSupport.IsLocked(RasterSupportType.PrintDriverServer)) { throw new Exception("Printer driver capability is required."); } if (FrmMain.StartedPrinter == string.Empty) { bSelectedPrinter = GetPrinterName(true); if (!bSelectedPrinter) { return(false); } SetCurrentPrinter(); } else { bSelectedPrinter = true; _currentPrinterName = FrmMain.StartedPrinter; SetCurrentPrinter(); } return(bSelectedPrinter); }
public static bool SetLicense(bool silent) { try { // TODO: Change this to use your license file and developer key */ string licenseFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\full_license.lic"; string developerKey = "gcxLXptTi5bPbVDDR9E+k4CRC8BLLm0IuN383qJp6jPqoMTYamOe1yuYzHqrCmFEN5zDcumaaCTXpO9GpeGal0wjSKF8nxnu"; var lic = File.ReadAllBytes(licenseFilePath); RasterSupport.SetLicense(lic, developerKey); //RasterSupport.SetLicense(licenseFilePath, developerKey); } catch (Exception ex) { //System.Diagnostics.Debug.Write(ex.Message); ServiceLog.WriteLog("Set License Error, " + ex.Message); } if (RasterSupport.KernelExpired) { if (silent == false) { string msg = "Your license file is missing, invalid or expired. LEADTOOLS will not function. Please contact LEAD Sales for information on obtaining a valid license."; string logmsg = string.Format("*** NOTE: {0} ***{1}", msg, Environment.NewLine); ServiceLog.WriteLog("*******************************************************************************" + Environment.NewLine); ServiceLog.WriteLog(logmsg); ServiceLog.WriteLog("*******************************************************************************" + Environment.NewLine); } return(false); } return(true); }
private bool SetLicense() { var _files = Directory.GetFiles(Path.Combine(LibUtilities.TheEnvironmentVariablePath, TheEnvVarSubDir.License), "*.*", SearchOption.AllDirectories) .Where(file => (file.ToLower().EndsWith("lic") || file.ToLower().EndsWith("key"))) .ToArray(); if (_files.ToList().Count < 2) { return(false); } if (string.IsNullOrWhiteSpace(_files.Where(file => file.ToLower().EndsWith("lic")).ToList()[0]) || string.IsNullOrWhiteSpace(_files.Where(file => file.ToLower().EndsWith("key")).ToList()[0])) { return(false); } RasterSupport.SetLicense(_files.Where(file => file.ToLower().EndsWith("lic")).ToList()[0], File.ReadAllText(_files.Where(file => file.ToLower().EndsWith("key")).ToList()[0])); if (RasterSupport.KernelExpired) { return(false); } if (RasterSupport.IsLocked(RasterSupportType.Forms)) { return(false); } if (RasterSupport.IsLocked(RasterSupportType.OcrLEAD)) { return(false); } return(true); }
public static bool SetLicense(bool silent) { try { //不读文件,改为直接写入字符串 //var key = File.ReadAllText(Application.StartupPath+"\\full_license.key"); string key = "gcxLXptTi5bPbVDDR9E+k4CRC8BLLm0IuN383qJp6jPqoMTYamOe1yuYzHqrCmFEN5zDcumaaCTXpO9GpeGal0wjSKF8nxnu"; var lic = File.ReadAllBytes(Application.StartupPath + "\\fl.lic"); RasterSupport.SetLicense(lic, key); } catch (Exception ex) { Debug.Write(ex.Message); } if (RasterSupport.KernelExpired) { string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); /* Try the common LIC directory */ string licenseFileRelativePath = Path.Combine(dir, "..\\..\\..\\Common\\License\\LEADTOOLS.LIC"); string keyFileRelativePath = Path.Combine(dir, "..\\..\\..\\Common\\License\\LEADTOOLS.LIC.key"); if (File.Exists(licenseFileRelativePath) && File.Exists(keyFileRelativePath)) { string developerKey = File.ReadAllText(keyFileRelativePath); try { RasterSupport.SetLicense(licenseFileRelativePath, developerKey); } catch (Exception ex) { Debug.Write(ex.Message); } } } if (RasterSupport.KernelExpired) { if (silent == false) { string msg = "Your license file is missing, invalid or expired. LEADTOOLS will not function. Please contact LEAD Sales for information on obtaining a valid license."; string logmsg = string.Format("*** NOTE: {0} ***{1}", msg, Environment.NewLine); Debugger.Log(0, null, "*******************************************************************************" + Environment.NewLine); Debugger.Log(0, null, logmsg); Debugger.Log(0, null, "*******************************************************************************" + Environment.NewLine); MessageBox.Show(null, msg, "No LEADTOOLS License", MessageBoxButtons.OK, MessageBoxIcon.Stop); Process.Start("https://www.leadtools.com/downloads/evaluation-form.asp?evallicenseonly=true"); } return(false); } return(true); }
public static bool SetLicense(bool silent) { try { // TODO: Change this to use your license file and developer key */ string licenseFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\full_license.lic"; string developerKey = "gcxLXptTi5bPbVDDR9E+k4CRC8BLLm0IuN383qJp6jPqoMTYamOe1yuYzHqrCmFEN5zDcumaaCTXpO9GpeGal0wjSKF8nxnu"; var lic = File.ReadAllBytes(licenseFilePath); RasterSupport.SetLicense(lic, developerKey); //RasterSupport.SetLicense(licenseFilePath, developerKey); } catch (Exception ex) { System.Diagnostics.Debug.Write(ex.Message); } if (RasterSupport.KernelExpired) { if (silent == false) { string msg = "Your license file is missing, invalid or expired. LEADTOOLS will not function. Please contact LEAD Sales for information on obtaining a valid license."; string logmsg = string.Format("*** NOTE: {0} ***{1}", msg, Environment.NewLine); System.Diagnostics.Debugger.Log(0, null, "*******************************************************************************" + Environment.NewLine); System.Diagnostics.Debugger.Log(0, null, logmsg); System.Diagnostics.Debugger.Log(0, null, "*******************************************************************************" + Environment.NewLine); MessageBox.Show(null, msg, "No LEADTOOLS License", MessageBoxButtons.OK, MessageBoxIcon.Stop); System.Diagnostics.Process.Start("https://www.leadtools.com/downloads/evaluation-form.asp?evallicenseonly=true"); } return(false); } return(true); }
static void Main() { if (!Support.SetLicense()) { return; } StartupMessageBox startupMsgBox = new StartupMessageBox("CSAnnotationsLayersDemo"); if (startupMsgBox.ShowStartUpDialog) { startupMsgBox.ShowDialog(); } if (RasterSupport.IsLocked(RasterSupportType.Document)) { MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.Document.ToString()), "Warning"); return; } Application.EnableVisualStyles(); Application.DoEvents(); Application.Run(new MainForm()); }
static void Main() { if (!Support.SetLicense()) { return; } Boolean bMedicalLocked = RasterSupport.IsLocked(RasterSupportType.Medical); if (bMedicalLocked) { MessageBox.Show("Medical support must be unlocked for this demo!", "Support Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Boolean bDocLocked = RasterSupport.IsLocked(RasterSupportType.Document); if (bDocLocked) { MessageBox.Show("Document support must be unlocked for this demo!", "Support Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (bMedicalLocked | bDocLocked) { return; } Application.Run(new MainForm()); }
static void Main() { if (Leadtools.Demos.Support.SetLicense(false) == false) { return; } if (RasterSupport.IsLocked(RasterSupportType.Omr)) { MessageBox.Show("OMR support must be unlocked. Application will exit."); return; } try { MainForm.GetOmrEngine(); } catch (Exception) { MessageBox.Show("Unable to initialize OMR engine. Application will exit."); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); }
private static bool UnlockLeadtools() { const string licenseFile = @"..\..\..\common\license\leadtools.lic"; try { var developerKey = File.ReadAllText(licenseFile + ".key"); RasterSupport.SetLicense(licenseFile, developerKey); if (RasterSupport.KernelExpired) { Console.WriteLine("LEADTOOLS License has Expired!\nPress [Enter] to exit."); Console.ReadLine(); return(false); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.WriteLine("\nPress [Enter] to exit."); Console.ReadLine(); return(false); } return(true); }
static void Main() { if (!Support.SetLicense()) { return; } Boolean bLocked = RasterSupport.IsLocked(RasterSupportType.Forms); if (bLocked) { MessageBox.Show("Forms support must be unlocked for this demo!", "Support Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Boolean bOCRLocked = RasterSupport.IsLocked(RasterSupportType.OcrLEAD) & RasterSupport.IsLocked(RasterSupportType.OcrOmniPage); if (bOCRLocked) { MessageBox.Show("OCR support must be unlocked for this demo!", "Support Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (bLocked | bOCRLocked) { return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MasterFormsWizard()); }
static void Main() { if (!Support.SetLicense()) { return; } if (RasterSupport.IsLocked(RasterSupportType.Medical)) { MessageBox.Show("Medical support must be unlocked for this demo!", "Support Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { mainForm = new MainForm(); Application.Run(mainForm); } catch (System.IO.FileNotFoundException) { string LTMM_MISSING = string.Format("This demo is designed to run ONLY if you have both a LEADTOOLS Medical toolkit " + "and a LEADTOOLS Multimedia toolkit installed.\n\n" + "In order to run this demo, please download and install the LEADTOOLS Multimedia SDK:\n" + "https://www.leadtools.com/downloads?category=mm"); if (MessageBox.Show(LTMM_MISSING + "\n\nDo you wish to navigate there now?", "LEADTOOLS Multimedia SDK Missing", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Error) == DialogResult.Yes) { System.Diagnostics.Process.Start("https://www.leadtools.com/downloads?category=mm"); } } }
public static void Startup() { //_logFile.WriteToLog("Applying Leadtools license..."); string licenseFileName = ""; string licenseFileWithLocation = ""; string developerKey = ""; try { string currDir = System.Reflection.Assembly.GetEntryAssembly().Location; currDir = Path.GetDirectoryName(currDir); licenseFileName = Properties.Settings.Default.LeadtoolsLicenseFile; licenseFileWithLocation = currDir + @"\" + licenseFileName; developerKey = Properties.Settings.Default.LeadtoolsDeveloperKey; //_logFile.WriteToLog("Applying license at: " + licenseFileWithLocation); //_logFile.WriteToLog("Applying key: " + developerKey); RasterSupport.SetLicense(licenseFileWithLocation, developerKey); //_logFile.WriteToLog("Applied Leadtools license."); codec = new RasterCodecs(); //_logFile.WriteToLog("Lead tools Codec object is created"); } catch (Exception e) { _logFile.WriteToLog("Problem applying Leadtools license:"); _logFile.WriteToLog("LeadtoolsLicenseFile = " + licenseFileName); _logFile.WriteToLog("licenseFileWithLocation = " + licenseFileWithLocation); _logFile.WriteToLog("LeadtoolsLicenseFile = " + developerKey); _logFile.WriteToLog(e.StackTrace + "\nInner Exception: " + e.InnerException); throw e; } }
public static bool SetLicense(Page mainPage, bool silent = false) { // Need Page as parameter instead of using MainPage as this code may execute within the Page's constructor RasterSupport.Initialize(mainPage); if (RasterSupport.KernelExpired) { try { byte[] licBytes = System.Text.Encoding.UTF8.GetBytes(LicContents); RasterSupport.SetLicense(licBytes, KeyContents); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } if (RasterSupport.KernelExpired && !silent) { string msg = "Your license file is missing, invalid or expired. LEADTOOLS will not function. Please contact LEAD Sales for information on obtaining a valid license."; MainThread.BeginInvokeOnMainThread(async() => await mainPage.DisplayAlert("Error", msg, "OK")); } return(!RasterSupport.KernelExpired); }
static void Main( ) { Application.EnableVisualStyles(); #if LEADTOOLS_V175_OR_LATER if (!Support.SetLicense()) { return; } #else Support.Unlock(false); #endif // #if LEADTOOLS_V175_OR_LATER #if LEADTOOLS_V175_OR_LATER if (RasterSupport.IsLocked(RasterSupportType.DicomCommunication)) { MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.DicomCommunication.ToString()), "Warning"); return; } #else if (RasterSupport.IsLocked(RasterSupportType.MedicalNet)) { MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.MedicalNet.ToString()), "Warning"); return; } #endif // #if LEADTOOLS_V175_OR_LATER Application.Run(new MainForm()); }
private bool Init() { // Check support required to use this demo if (RasterSupport.IsLocked(RasterSupportType.Document)) { Messager.ShowError(this, string.Format(DemosGlobalization.GetResxString(GetType(), "resx_DemoWillExit"), "RasterSupportType.Document")); return(false); } _rasterCodecs = new RasterCodecs(); _demoOptions = DemoOptions.Load(); _viewerControl.Visible = false; _pagesControl.Visible = false; _documentAnnotations = new DocumentAnnotations(this); _viewerControl.BringToFront(); UpdateUIState(); LoadDefaultDocument(); return(true); }
private void UnlockLeadToolsPDFSupport() { if (RasterSupport.IsLocked(RasterSupportType.PdfAdvanced)) { RasterSupport.Unlock(RasterSupportType.PdfAdvanced, "haDLeYrAE"); } }
private bool TrySetLicense(string licensePath, string developerKey) { try { RasterSupport.SetLicense(licensePath, developerKey); //try to set license } catch (Exception ex) { // log.Error(ex, "Error while setup license"); } if (RasterSupport.KernelExpired) { // log.Error("Your license file is missing, invalid or expired. LEADTOOLS will not function. Please contact LEAD Sales for information on obtaining a valid license."); return(false); } if (RasterSupport.IsLocked(RasterSupportType.Forms)) { // log.Error("Forms support must be unlocked!"); return(false); } if (RasterSupport.IsLocked(RasterSupportType.OcrLEAD)) { // log.Error("OCR support must be unlocked!"); return(false); } // log.Info("Licnse is valid."); return(true); }
private void Rotate(int angle) { RasterImage image = _imageViewer.Image; // We must rotate our overlay rect too. We could rotate it ourselves or we could do this: // Get the rect in image coordinates (regardless of the view persective) // Rotate the image // Get the rect again in top-left from the image coordinates we saved LeadRect imageRect = LeadRect.Empty; if (!_overlayRect.IsEmpty) { // Save the overlay rect in image coordinates imageRect = image.RectangleToImage(RasterViewPerspective.TopLeft, _overlayRect); } if (RasterSupport.IsLocked(RasterSupportType.Document)) { MessageBox.Show("Document support must be unlocked for this demo!", "Support Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // Fast rotation involves changing the image view-perspective image.RotateViewPerspective(angle); if (!_overlayRect.IsEmpty) { // Now re-get the overlay rectangle as top left from the image data coordinates // we saved _overlayRect = image.RectangleFromImage(RasterViewPerspective.TopLeft, imageRect); } UpdateImageInfo(); }
static void Main(string[] args) { String fileToConvert = @"FILE PATH HERE"; RasterSupport.SetLicense(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC", System.IO.File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC.KEY")); using (RasterCodecs codecs = new RasterCodecs()) { using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false)) { ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime"); using (IOcrPage ocrPage = ocrEngine.CreatePage(ocrEngine.RasterCodecsInstance.Load(fileToConvert, 1), OcrImageSharingMode.AutoDispose)) { ocrPage.AutoZone(null); ocrPage.Recognize(null); string recognizedCharacters = ocrPage.GetText(-1); BarcodeEngine engine = new BarcodeEngine(); int resolution = 300; using (RasterImage image = RasterImage.Create((int)(8.5 * resolution), (int)(11.0 * resolution), 1, resolution, RasterColor.FromKnownColor(RasterKnownColor.White))) { BarcodeWriter writer = engine.Writer; QRBarcodeData data = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.QR) as QRBarcodeData; data.Bounds = new LeadRect(0, 0, image.ImageWidth, image.ImageHeight); QRBarcodeWriteOptions writeOptions = writer.GetDefaultOptions(data.Symbology) as QRBarcodeWriteOptions; writeOptions.XModule = 30; writeOptions.HorizontalAlignment = BarcodeAlignment.Near; writeOptions.VerticalAlignment = BarcodeAlignment.Near; data.Value = recognizedCharacters; writer.CalculateBarcodeDataBounds(new LeadRect(0, 0, image.ImageWidth, image.ImageHeight), image.XResolution, image.YResolution, data, writeOptions); Console.WriteLine("{0} by {1} pixels", data.Bounds.Width, data.Bounds.Height); writer.WriteBarcode(image, data, writeOptions); CropCommand cmd = new CropCommand(new LeadRect(0, 0, data.Bounds.Width, data.Bounds.Height)); cmd.Run(image); codecs.Save(image, "QR.tif", RasterImageFormat.CcittGroup4, 1); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var process = new Process(); process.StartInfo = new ProcessStartInfo("QR.tif") { UseShellExecute = true }; process.Start(); } Console.WriteLine(); } } } } }
public BarcodesController() { barcodeEngineInstance = new BarcodeEngine(); // Requires a license file that unlocks 1D barcode read functionality. string MY_LICENSE_FILE = @"C:\LEADTOOLS 20\Common\License\leadtools.lic"; string MY_DEVELOPER_KEY = System.IO.File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\leadtools.lic.key"); RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DEVELOPER_KEY); }
private static void UnlockSupport() { // TODO: This is using the default path; change as needed. // If you need a license file, go to https://www.leadtools.com/downloads?category=main const string lic = @"C:\leadtools 19\common\license\Leadtools.lic"; var key = File.ReadAllText(@"C:\leadtools 19\common\license\Leadtools.lic.key"); RasterSupport.SetLicense(lic, key); }
private static void UnlockSupport() { // TODO: If you need a license file, go to https://www.leadtools.com/downloads?category=main var lic = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"Leadtools.lic"); var key = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"Leadtools.lic.key")); RasterSupport.SetLicense(lic, key); }
static void Initialize() { RasterSupport.SetLicense(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC", System.IO.File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC.KEY")); codecs = new RasterCodecs(); ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false); ocrEngine.Startup(null, null, null, null); }
public static bool SetLicense(bool silent = false) { try { var developerKey = System.IO.File.ReadAllText(DeveloperKeyPath); RasterSupport.SetLicense(LicenseFilePath, developerKey); } catch (Exception ex) { System.Diagnostics.Debug.Write(ex.Message); } if (RasterSupport.KernelExpired) { var dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); /* Try the common LIC directory */ if (dir != null) { var licenseFileRelativePath = System.IO.Path.Combine(dir, Path.RelativePathToRoot, "common-files\\leadtools-license\\eval-license-files.LIC"); var keyFileRelativePath = System.IO.Path.Combine(dir, Path.RelativePathToRoot, "common-files\\leadtools-license\\eval-license-files.LIC.key"); if (System.IO.File.Exists(licenseFileRelativePath) && System.IO.File.Exists(keyFileRelativePath)) { var developerKey = System.IO.File.ReadAllText(keyFileRelativePath); try { RasterSupport.SetLicense(licenseFileRelativePath, developerKey); } catch (Exception ex) { System.Diagnostics.Debug.Write(ex.Message); } } } } if (!RasterSupport.KernelExpired) { return(true); } if (silent) { return(false); } const string msg = "Your license file is missing, invalid, or expired. LEADTOOLS will not function.\nPlease contact [email protected] for information on obtaining a valid license."; var logmsg = string.Format("*** NOTE: {0} ***{1}", msg, Environment.NewLine); System.Diagnostics.Debugger.Log(0, null, "*******************************************************************************" + Environment.NewLine); System.Diagnostics.Debugger.Log(0, null, logmsg); System.Diagnostics.Debugger.Log(0, null, "*******************************************************************************" + Environment.NewLine); Console.WriteLine(msg); Path.ShellExecute(NewEvaluationLicenseUrl); return(false); }
public SingleUseCouponsController(ApplicationDbContext context, IHostingEnvironment host) { _context = context; _host = host; barcodeEngineInstance = new BarcodeEngine(); // Requires a license file that unlocks 1D barcode read functionality. string MY_LICENSE_FILE = @"C:\LEADTOOLS 20\Common\License\leadtools.lic"; string MY_DEVELOPER_KEY = System.IO.File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\leadtools.lic.key"); RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DEVELOPER_KEY); }
private void MainForm_Load(object sender, EventArgs e) { //Set our LEADTOOLS License and Developer Key RasterSupport.SetLicense(@"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC", System.IO.File.ReadAllText(@"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC.KEY")); //Create a RasterCodecs Instance _codecs = new RasterCodecs(); //Startup our DICOM Engine DicomEngine.Startup(); }
private static void Unlock(bool check) { RasterSupport.Unlock(RasterSupportType.Abc, ""); RasterSupport.Unlock(RasterSupportType.AbicRead, ""); RasterSupport.Unlock(RasterSupportType.AbicSave, ""); RasterSupport.Unlock(RasterSupportType.Barcodes1D, ""); RasterSupport.Unlock(RasterSupportType.Barcodes1DSilver, ""); RasterSupport.Unlock(RasterSupportType.BarcodesDataMatrixRead, ""); RasterSupport.Unlock(RasterSupportType.BarcodesDataMatrixWrite, ""); RasterSupport.Unlock(RasterSupportType.BarcodesPdfRead, ""); RasterSupport.Unlock(RasterSupportType.BarcodesPdfWrite, ""); RasterSupport.Unlock(RasterSupportType.BarcodesQRRead, ""); RasterSupport.Unlock(RasterSupportType.BarcodesQRWrite, ""); RasterSupport.Unlock(RasterSupportType.Bitonal, ""); RasterSupport.Unlock(RasterSupportType.Ccow, ""); RasterSupport.Unlock(RasterSupportType.Cmw, ""); RasterSupport.Unlock(RasterSupportType.Dicom, ""); RasterSupport.Unlock(RasterSupportType.Document, ""); RasterSupport.Unlock(RasterSupportType.DocumentWriters, ""); RasterSupport.Unlock(RasterSupportType.DocumentWritersPdf, ""); RasterSupport.Unlock(RasterSupportType.ExtGray, ""); RasterSupport.Unlock(RasterSupportType.Forms, ""); RasterSupport.Unlock(RasterSupportType.IcrPlus, ""); RasterSupport.Unlock(RasterSupportType.IcrProfessional, ""); RasterSupport.Unlock(RasterSupportType.J2k, ""); RasterSupport.Unlock(RasterSupportType.Jbig2, ""); RasterSupport.Unlock(RasterSupportType.Jpip, ""); RasterSupport.Unlock(RasterSupportType.Pro, ""); RasterSupport.Unlock(RasterSupportType.LeadOmr, ""); RasterSupport.Unlock(RasterSupportType.MediaWriter, ""); RasterSupport.Unlock(RasterSupportType.Medical, ""); RasterSupport.Unlock(RasterSupportType.Medical3d, ""); RasterSupport.Unlock(RasterSupportType.MedicalNet, ""); RasterSupport.Unlock(RasterSupportType.Mobile, ""); RasterSupport.Unlock(RasterSupportType.Nitf, ""); RasterSupport.Unlock(RasterSupportType.OcrAdvantage, ""); RasterSupport.Unlock(RasterSupportType.OcrAdvantagePdfLeadOutput, ""); RasterSupport.Unlock(RasterSupportType.OcrArabic, ""); RasterSupport.Unlock(RasterSupportType.OcrArabicPdfLeadOutput, ""); RasterSupport.Unlock(RasterSupportType.OcrPlus, ""); RasterSupport.Unlock(RasterSupportType.OcrPlusPdfOutput, ""); RasterSupport.Unlock(RasterSupportType.OcrPlusPdfLeadOutput, ""); RasterSupport.Unlock(RasterSupportType.OcrProfessional, ""); RasterSupport.Unlock(RasterSupportType.OcrProfessionalAsian, ""); RasterSupport.Unlock(RasterSupportType.OcrProfessionalPdfOutput, ""); RasterSupport.Unlock(RasterSupportType.OcrProfessionalPdfLeadOutput, ""); RasterSupport.Unlock(RasterSupportType.PdfAdvanced, ""); RasterSupport.Unlock(RasterSupportType.PdfRead, ""); RasterSupport.Unlock(RasterSupportType.PdfSave, ""); RasterSupport.Unlock(RasterSupportType.PrintDriver, ""); RasterSupport.Unlock(RasterSupportType.PrintDriverServer, ""); RasterSupport.Unlock(RasterSupportType.Vector, ""); }
private static void Printer_EmfEvent(object sender, EmfEventArgs e) { string licString = @"F:\LeadToolsDeveloperTrialVersion\eval-license-files_ca9205db-0588-4317-8b13-dc1fef29e86e\eval-license-files.lic"; string developerKey = "g8xOXslT1JadbVXDQNE7k4CRUMBLLjEIvt383qJptzPvoMXYamOe13OYknr9CmFEbpzAcriaPCSEpO9G9+HPl0sjQaEqn0zu"; RasterSupport.SetLicense(licString, developerKey); System.IO.File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir, @"LEADTOOLS_IMAGE1.emf"), e.Stream.ToArray()); Metafile metaFile = new Metafile(e.Stream); Image emfImage = metaFile.GetThumbnailImage(metaFile.Width, metaFile.Height, null, IntPtr.Zero); emfImage.Save(Path.Combine(LEAD_VARS.ImagesDir, @"LEADTOOLS_IMAGE2.emf")); }
private bool Init() { // Check support required to use this program if (RasterSupport.IsLocked(RasterSupportType.Barcodes1D) && RasterSupport.IsLocked(RasterSupportType.Barcodes2D)) { Messager.ShowError(this, BarcodeGlobalization.GetResxString(GetType(), "Resx_LEADBarcodeSupport")); return(false); } try { _rasterCodecs = new RasterCodecs(); } catch (Exception ex) { Messager.ShowError(this, string.Format("RasterCodec initialize error: {0}", ex.Message)); return(false); } // this is very important, must be placed leadtools.engine.dll in this path _rasterCodecs.Options.Pdf.InitialPath = AppDomain.CurrentDomain.BaseDirectory; _barcodeOptions = BarcodeOptions.Load(); //BarcodeSymbology[] supportedSymbologies = BarcodeEngine.GetSupportedSymbologies(); WriteLine(string.Format("{0} Supported symbologies:", _barcodeOptions.ReadOptionsSymbologies.Length), TraceEventType.Information); foreach (BarcodeSymbology symbology in _barcodeOptions.ReadOptionsSymbologies) { WriteLine(string.Format("{0}: {1}", symbology, BarcodeEngine.GetSymbologyFriendlyName(symbology)), TraceEventType.Information); } WriteLine(string.Format("----------"), TraceEventType.Information); _sampleSymbologiesRasterImage = null; // Create the barcodes symbologies multi-frame RasterImage using (Stream stream = GetType().Assembly.GetManifestResourceStream("BarcodeSplitManage.Resources.Symbologies.tif")) { _rasterCodecs.Options.Load.AllPages = true; _sampleSymbologiesRasterImage = _rasterCodecs.Load(stream); } _barcodeEngine = new BarcodeEngine(); _barcodeEngine.Reader.ImageType = BarcodeImageType.Unknown; _barcodeEngine.Reader.EnableReturnFourPoints = false; // Continue on errors _barcodeEngine.Reader.ErrorMode = BarcodeReaderErrorMode.IgnoreAll; _directorySettings = new DirectorySettings(); return(true); }
private void InitViewer() { // Use ScaleToGray and Bicubic for optimum viewing of black/white and color images RasterPaintProperties props = _rasterImageViewer.PaintProperties; props.PaintDisplayMode |= RasterPaintDisplayModeFlags.Bicubic; if (!RasterSupport.IsLocked(RasterSupportType.Document)) { props.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray; } _rasterImageViewer.PaintProperties = props; // Pad the viewer _rasterImageViewer.Padding = new Padding(10); // Set the cursors _noneInteractiveMode = new ImageViewerNoneInteractiveMode(); _panInteractiveMode = new ImageViewerPanZoomInteractiveMode(); _panInteractiveMode.MouseButtons = System.Windows.Forms.MouseButtons.Left; _zoomToInteractiveMode = new ImageViewerZoomToInteractiveMode(); _zoomToInteractiveMode.RubberBandCompleted += new EventHandler <ImageViewerRubberBandEventArgs>(_rasterImageViewer_InteractiveZoomTo); _rectInteractiveMode = new ImageViewerRubberBandInteractiveMode(); _regionInteractiveMode = new ImageViewerAddRegionInteractiveMode(); _regionInteractiveMode.RubberBandCompleted += new EventHandler <ImageViewerRubberBandEventArgs>(_rasterImageViewer_InteractiveRegionRectangle); _regionInteractiveMode.RubberBandStarted += new EventHandler <ImageViewerRubberBandEventArgs>(RegionInteractiveMode_RubberBandStarted); _rectInteractiveMode.RubberBandCompleted += new EventHandler <ImageViewerRubberBandEventArgs>(RectInteractiveMode_RubberBandCompleted); _noneInteractiveMode.IdleCursor = Cursors.Arrow; _noneInteractiveMode.WorkingCursor = Cursors.Arrow; _panInteractiveMode.IdleCursor = Cursors.Hand; _panInteractiveMode.WorkingCursor = Cursors.Hand; _zoomToInteractiveMode.IdleCursor = Cursors.Cross; _zoomToInteractiveMode.WorkingCursor = Cursors.Cross; _rectInteractiveMode.IdleCursor = Cursors.Cross; _rectInteractiveMode.WorkingCursor = Cursors.Cross; _regionInteractiveMode.IdleCursor = Cursors.Cross; _regionInteractiveMode.WorkingCursor = Cursors.Cross; _rasterImageViewer.InteractiveModes.BeginUpdate(); _rasterImageViewer.InteractiveModes.Add(_noneInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_panInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_zoomToInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_rectInteractiveMode); _rasterImageViewer.InteractiveModes.Add(_regionInteractiveMode); _rasterImageViewer.InteractiveModes.EndUpdate(); }