/// <summary> /// Finalize the Node. /// </summary> /// <returns> /// Success of the Operation. /// </returns> public override bool Finalize() { _isRunning = false; if (_device != null) { lock (_device) { _device.Finalize(); _device = null; } } if (_imageProperty != null) _imageProperty = null; return base.Finalize(); }
/// <summary> /// Initialze the Plugin. /// </summary> /// <returns> /// Success of the Operation. /// </returns> public override bool Initialize() { base.Initialize(); bool result = false; _deviceProperty = GetProperty("Interface") as DeviceProperty; if (_deviceProperty == null) { Trace.WriteLine("Device interface is null!", LogCategory.Error); return false; } _deviceProperty.PropertyChanged -= DeviceProperty_PropertyChanged; _deviceProperty.PropertyChanged += DeviceProperty_PropertyChanged; _device = _deviceProperty.Value as ImageDevice; if (_device == null) { Trace.WriteLine("Device is null!", LogCategory.Error); return false; } _imageProperty = GetProperty(typeof(ImageProperty)) as ImageProperty; if (_device == null) { Trace.WriteLine("Device interface is null!", LogCategory.Error); } else { result = _device.Initialize(); if (!result) Trace.WriteLine("Could not initialize device!", LogCategory.Error); } _isRunning = result; return result; }
public virtual void Export(string sourcePath, string outPath, RenderingOptions options = null) { switch (dstFormat_) { case ExportFormat.PDF: PdfRenderingOptions pdf_opts = options as PdfRenderingOptions; if (pdf_opts == null) { pdf_opts = new PdfRenderingOptions(); } using (PdfDevice device = new PdfDevice(pdf_opts, outPath)) { Render(sourcePath, device); } break; case ExportFormat.XPS: XpsRenderingOptions xps_opts = options as XpsRenderingOptions ; if (xps_opts == null) { xps_opts = new XpsRenderingOptions(); } using (XpsDevice device = new XpsDevice(xps_opts, outPath)) { Render(sourcePath, device); } break; case ExportFormat.MD: IDevice nullDev = null; Render(sourcePath, nullDev); break; case ExportFormat.MHTML: throw new NotImplementedException("Conversion to 'MHTML' isn't implemented yet."); //break; case ExportFormat.JPEG: case ExportFormat.PNG: case ExportFormat.BMP: case ExportFormat.TIFF: case ExportFormat.GIF: ImageRenderingOptions img_opts = options as ImageRenderingOptions; if (img_opts == null) { img_opts = new ImageRenderingOptions(); } switch (dstFormat_) { case ExportFormat.JPEG: img_opts.Format = ImageFormat.Jpeg; break; case ExportFormat.PNG: img_opts.Format = ImageFormat.Png; break; case ExportFormat.BMP: img_opts.Format = ImageFormat.Bmp; break; case ExportFormat.TIFF: img_opts.Format = ImageFormat.Tiff; break; case ExportFormat.GIF: img_opts.Format = ImageFormat.Gif; break; } using (ImageDevice device = new ImageDevice(img_opts, outPath)) { Render(sourcePath, device); } break; } }