public void SaveBarcodeExec() { try { using (PrinterX myPrinter = new PrinterX()) { string DocumentName = String.Format("{0}_{1}_{2}.tif", CurrentBarcodeInfo.PrimaryBarcodeValue, CurrentBarcodeInfo.SecondaryBarcodeValue, DateTime.Now.ToString("yyyyMMddhhmmss")); // Let factory create the IOpenFileDialog IFolderBrowserDialog folderBrowserDialog = folderBrowserDialogFactory(); folderBrowserDialog.Description = "Choose Folder"; folderBrowserDialog.ShowNewFolderButton = true; // Open the dialog System.Windows.Forms.DialogResult result = dialogService.ShowFolderBrowserDialog(this, folderBrowserDialog); if (result == System.Windows.Forms.DialogResult.OK) { System.Drawing.Imaging.ImageCodecInfo codecInfo = getCodecForstring("TIFF"); System.Drawing.Imaging.EncoderParameters ep = new System.Drawing.Imaging.EncoderParameters(1); ep.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Compression, Convert.ToInt32(System.Drawing.Imaging.EncoderValue.CompressionCCITT4)); CurrentBarcodeImage.Save(Path.Combine(folderBrowserDialog.SelectedPath, DocumentName), codecInfo, ep); } } } catch (Exception ex) { HandleErrorMessage(ex); } }
public void PrintBarcodeExec() { try { using (PrinterX myPrinter = new PrinterX()) { string DocumentName = String.Format("{0}_{1}_{2}", CurrentBarcodeInfo.PrimaryBarcodeValue, CurrentBarcodeInfo.SecondaryBarcodeValue, DateTime.Now.ToString("yyyyMMddhhmmss")); myPrinter.PrintDocumentVis(CurrentBarcodeImage, DocumentName); } } catch (Exception ex) { HandleErrorMessage(ex); } }