private void UnlockLeadToolsPDFSupport() { if (RasterSupport.IsLocked(RasterSupportType.PdfAdvanced)) { RasterSupport.Unlock(RasterSupportType.PdfAdvanced, "haDLeYrAE"); } }
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 Unlock() { RasterSupport.Unlock(RasterSupportType.Dicom, "y47S3rZv6U"); RasterSupport.Unlock(RasterSupportType.Document, "HbQR9NSXQ3"); RasterSupport.Unlock(RasterSupportType.DocumentWriters, "BhaNezSEBB"); RasterSupport.Unlock(RasterSupportType.DocumentWritersPdf, "3b39Q3YMdX"); RasterSupport.Unlock(RasterSupportType.ExtGray, "bpTmxSfx8R"); RasterSupport.Unlock(RasterSupportType.Forms, "GpC33ZK78k"); RasterSupport.Unlock(RasterSupportType.IcrPlus, "9vdKEtBhFy"); RasterSupport.Unlock(RasterSupportType.IcrProfessional, "3p2UAxjTy5"); RasterSupport.Unlock(RasterSupportType.J2k, "Hvu2PRAr3z"); RasterSupport.Unlock(RasterSupportType.Jbig2, "43WiSV4YNB"); RasterSupport.Unlock(RasterSupportType.Jpip, "YbGG7wWiVJ"); RasterSupport.Unlock(RasterSupportType.Pro, ""); RasterSupport.Unlock(RasterSupportType.LeadOmr, "J3vh828GC8"); RasterSupport.Unlock(RasterSupportType.MediaWriter, "TpjDw2kJD2"); RasterSupport.Unlock(RasterSupportType.Medical, "ZhyFRnk3sY"); RasterSupport.Unlock(RasterSupportType.Medical3d, "DvuzH3ePeu"); RasterSupport.Unlock(RasterSupportType.MedicalNet, "b4nBinY7tv"); RasterSupport.Unlock(RasterSupportType.MedicalServer, "QbXwuZxA3h"); RasterSupport.Unlock(RasterSupportType.Mobile, ""); RasterSupport.Unlock(RasterSupportType.Nitf, "G37rmw5dTr"); DicomEngine.Startup(); }
private void button1_Click(object sender, EventArgs e) { _storageScu = new StorageScu(editAE.Text, editAE.Text, editIP.Text, Convert.ToInt16(editPort.Text)); _storageScu.ImageStoreCompleted += new EventHandler <StorageInstance>(storageScu_StoreCompleted); //_storageScu.AddStorageInstance(new StorageInstance("AnotherFile.dcm")); ClearCanvas.ImageViewer.ImageViewerComponent viewer = null; DesktopWindow desktopWindow = null; List <string> _filenames = new List <string>(); foreach (DesktopWindow window in Application.DesktopWindows) { foreach (Workspace space in window.Workspaces) { if (space.Title == "imageview") { desktopWindow = window; viewer = space.Component as ClearCanvas.ImageViewer.ImageViewerComponent; } } } if (viewer != null) { //foreach (string strfile in viewer.getCurrentFiles()) // _storageScu.AddFile(strfile); //先解压缩,然后再发送 //foreach (string strfile in viewer.getCurrentFiles()) // _storageScu.AddFile(strfile); RasterSupport.Unlock(RasterSupportType.Dicom, "y47S3rZv6U"); RasterSupport.Unlock(RasterSupportType.Document, "HbQR9NSXQ3"); RasterSupport.Unlock(RasterSupportType.DocumentWriters, "BhaNezSEBB"); RasterSupport.Unlock(RasterSupportType.DocumentWritersPdf, "3b39Q3YMdX"); RasterSupport.Unlock(RasterSupportType.ExtGray, "bpTmxSfx8R"); RasterSupport.Unlock(RasterSupportType.Forms, "GpC33ZK78k"); RasterSupport.Unlock(RasterSupportType.IcrPlus, "9vdKEtBhFy"); RasterSupport.Unlock(RasterSupportType.IcrProfessional, "3p2UAxjTy5"); RasterSupport.Unlock(RasterSupportType.J2k, "Hvu2PRAr3z"); RasterSupport.Unlock(RasterSupportType.Jbig2, "43WiSV4YNB"); RasterSupport.Unlock(RasterSupportType.Jpip, "YbGG7wWiVJ"); RasterSupport.Unlock(RasterSupportType.Pro, ""); RasterSupport.Unlock(RasterSupportType.LeadOmr, "J3vh828GC8"); RasterSupport.Unlock(RasterSupportType.MediaWriter, "TpjDw2kJD2"); RasterSupport.Unlock(RasterSupportType.Medical, "ZhyFRnk3sY"); RasterSupport.Unlock(RasterSupportType.Medical3d, "DvuzH3ePeu"); RasterSupport.Unlock(RasterSupportType.MedicalNet, "b4nBinY7tv"); RasterSupport.Unlock(RasterSupportType.MedicalServer, "QbXwuZxA3h"); RasterSupport.Unlock(RasterSupportType.Mobile, ""); RasterSupport.Unlock(RasterSupportType.Nitf, "G37rmw5dTr"); DicomEngine.Startup(); foreach (string strfile in viewer.getCurrentFiles()) { DicomDataSet ds = new DicomDataSet(); try { ds.Load(strfile, DicomDataSetLoadFlags.None); ds.ChangeTransferSyntax(DicomUidType.ImplicitVRLittleEndian, 2, ChangeTransferSyntaxFlags.None); ds.Save(strfile + "1", DicomDataSetSaveFlags.None); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } _storageScu.AddFile(strfile + "1"); } } else { System.Windows.Forms.MessageBox.Show("没有合适的图像。。。"); } IAsyncResult asyncResult = _storageScu.BeginSend(new AsyncCallback(SendComplete), _storageScu); }
/// <summary> /// Converts all the image file into one PDF file. /// </summary> /// <param name="imagePath">The collection of image files to combine.</param> /// <returns>True if the conversion was successful; else false.</returns> private bool ConvertImage(string[] imagePath) { try { // Get the unlock key RasterSupport.Unlock(RasterSupportType.PdfSave, _documentUnlockKey); // Startup the codecs RasterCodecs.Startup(); using (RasterCodecs codecs = new RasterCodecs()) { // Assign the codec options codecs.Options.Jpeg.Save.QualityFactor = _pdfDocumentQualityFactor; codecs.Options.Jpeg.Save.SaveWithStamp = false; codecs.Options.Jpeg.Save.StampBitsPerPixel = 0; // Set the raster image format. RasterImageFormat rasterImageFormat = RasterImageFormat.RasPdfJpeg411; // Set the pdf save type. switch (_saveType) { case PdfSaveType.PdfA: codecs.Options.Pdf.Save.SavePdfA = true; rasterImageFormat = RasterImageFormat.RasPdfJpeg; break; case PdfSaveType.Pdf14: codecs.Options.Pdf.Save.SavePdfv14 = true; rasterImageFormat = RasterImageFormat.RasPdfJpeg411; break; case PdfSaveType.Pdf15: codecs.Options.Pdf.Save.SavePdfv15 = true; rasterImageFormat = RasterImageFormat.RasPdfJpeg422; break; } // If the load tool resource path has been specified. if (!String.IsNullOrEmpty(_leadToolResPath)) { codecs.Options.Pdf.InitialPath = _leadToolResPath + "Lib;" + _leadToolResPath + "Fonts;" + _leadToolResPath + "Resource"; } // For each image file found append into the PDF document. for (int i = 0; i < imagePath.Length; i++) { // Load the image file into the image type. using (System.Drawing.Image srcImage = System.Drawing.Image.FromFile(imagePath[i])) using (RasterImage image = new RasterImage(srcImage)) { if (i > 0) { // Append each image file to the PDF document. codecs.Save(image, _pdfDocumentPath, rasterImageFormat, _pdfDocumentBitPerPixel, 1, 1, 1, CodecsSavePageMode.Append); } else { // Create or overwrite the PDF document and // place to first image at the top of the PDF. codecs.Save(image, _pdfDocumentPath, rasterImageFormat, _pdfDocumentBitPerPixel, 1, 1, 1, CodecsSavePageMode.Overwrite); } } } } // Return the result. return(true); } finally { // Shutdown the codecs RasterCodecs.Shutdown(); // If the event has been attached, then // send a complete to the client. if (OnComplete != null) { OnComplete(this, new EventArgs()); } } }
/// <summary> /// Convert the current image to a PDF document. /// </summary> /// <returns>True if the conversion was successful; else false.</returns> private bool ConvertImage() { try { // Get the unlock key RasterSupport.Unlock(RasterSupportType.PdfSave, _documentUnlockKey); // Startup the codecs RasterCodecs.Startup(); using (RasterCodecs codecs = new RasterCodecs()) { // Load the image file into the image type. using (System.Drawing.Image srcImage = System.Drawing.Image.FromFile(_imageDocumentPath)) using (RasterImage image = new RasterImage(srcImage)) { codecs.Options.Jpeg.Save.QualityFactor = _pdfDocumentQualityFactor; codecs.Options.Jpeg.Save.SaveWithStamp = false; codecs.Options.Jpeg.Save.StampBitsPerPixel = 0; codecs.Options.Jpeg.Save.StampWidth = image.Width; codecs.Options.Jpeg.Save.StampHeight = image.Height; // Set the raster image format. RasterImageFormat rasterImageFormat = RasterImageFormat.RasPdfJpeg411; // Set the pdf save type. switch (_saveType) { case PdfSaveType.PdfA: codecs.Options.Pdf.Save.SavePdfA = true; rasterImageFormat = RasterImageFormat.RasPdfJpeg; break; case PdfSaveType.Pdf14: codecs.Options.Pdf.Save.SavePdfv14 = true; rasterImageFormat = RasterImageFormat.RasPdfJpeg411; break; case PdfSaveType.Pdf15: codecs.Options.Pdf.Save.SavePdfv15 = true; rasterImageFormat = RasterImageFormat.RasPdfJpeg422; break; } // If the load tool resource path has been specified. if (!String.IsNullOrEmpty(_leadToolResPath)) { codecs.Options.Pdf.InitialPath = _leadToolResPath + "Lib;" + _leadToolResPath + "Fonts;" + _leadToolResPath + "Resource"; } // Attempt to save the image. codecs.Save(image, _pdfDocumentPath, rasterImageFormat, _pdfDocumentBitPerPixel); } } return(true); } finally { // Shutdown the codecs RasterCodecs.Shutdown(); // If the event has been attached, then // send a complete to the client. if (OnComplete != null) { OnComplete(this, new EventArgs()); } } }
private string DoTheConvert(string sourceImage, string actionProfile, string annotate, ReturnPath retPath) { string strRetFile = ""; strActionProfile = actionProfile; strAnnotate = annotate; this.sourceImage = sourceImage; try { RasterCodecs.Startup(); RasterSupport.Unlock(RasterSupportType.Pro, "LhwcFdF3jN"); bool isLocked = RasterSupport.IsLocked(RasterSupportType.Pro); rasterCodecs = new RasterCodecs(); imageInfo = rasterCodecs.GetInformation(sourceImage, true); if (imageInfo.TotalPages > 0 && imageInfo.Format == Leadtools.RasterImageFormat.Gif) { rasterCodecs.Options.Gif.Load.AnimationLoop = imageInfo.Gif.AnimationLoop; rasterCodecs.Options.Gif.Save.AnimationLoop = imageInfo.Gif.AnimationLoop; rasterCodecs.Options.Gif.Save.UseAnimationLoop = imageInfo.Gif.HasAnimationLoop; if (imageInfo.Gif.HasAnimationBackground) { rasterCodecs.Options.Gif.Save.AnimationBackground = imageInfo.Gif.AnimationBackground; } rasterCodecs.Options.Gif.Save.UseAnimationBackground = imageInfo.Gif.HasAnimationBackground; // #1.0.5.0 if (imageInfo.Gif.HasAnimationPalette) { rasterCodecs.Options.Gif.Save.SetAnimationPalette(imageInfo.Gif.GetAnimationPalette()); } rasterCodecs.Options.Gif.Save.UseAnimationPalette = imageInfo.Gif.HasAnimationPalette; rasterCodecs.Options.Gif.Save.AnimationWidth = imageInfo.Gif.AnimationWidth; rasterCodecs.Options.Gif.Save.AnimationHeight = imageInfo.Gif.AnimationHeight; } img = rasterCodecs.Load(sourceImage); // Load convert action profile if (Init(sourceImage, strActionProfile)) { // loop on actions LoopActions(); SaveImage(); // add a copyright or something like this to the image if (xmlActionProfile.SelectSingleNode("//root/actionProfile[@ID='" + strActionProfile + "']/action[@ID='annotate']") != null && strTargetImage.Length > 0) { Annotate(); } if (retPath == ReturnPath.AbsPath) { strRetFile = strTargetImage; } else if (retPath == ReturnPath.Url) { strRetFile = strTargetImageUrl; } } } finally { img.Dispose(); RasterCodecs.Shutdown(); } return(strRetFile); }