private void SetOptions(DocumentConverter converter, ObjectCache cache, LEADDocument document, ConvertRedactionOptions redactionOptions) { converter.SetAnnRenderingEngineInstance(this.AnnRenderingEngine); // Set the RasterCodecs instance, should go into the DocumentFactory class which will be used to load the document if (this.RasterCodecsInstance != null) { DocumentFactory.RasterCodecsTemplate = this.RasterCodecsInstance; } // Set the OCR engine if (this.OcrEngineInstance != null && this.OcrEngineInstance.IsStarted) { converter.SetOcrEngineInstance(this.OcrEngineInstance, false); } if (this.DocumentWriterInstance != null) { converter.SetDocumentWriterInstance(this.DocumentWriterInstance); } // Set pre-processing options converter.Preprocessor.Deskew = this.PreprocessingDeskew; converter.Preprocessor.Invert = this.PreprocessingInvert; converter.Preprocessor.Orient = this.PreprocessingOrient; // Enable trace converter.Diagnostics.EnableTrace = this.EnableTrace; // Setup the load document options var loadDocumentOptions = new LoadDocumentOptions(); // Setup cache loadDocumentOptions.Cache = cache; loadDocumentOptions.UseCache = cache != null; if (document == null) { // Set the input annotation mode or file name loadDocumentOptions.LoadEmbeddedAnnotations = this.LoadEmbeddedAnnotation; if (!this.LoadEmbeddedAnnotation && !string.IsNullOrEmpty(this.InputAnnotationsFileName) && File.Exists(this.InputAnnotationsFileName)) { // We will use this instead of DocumentConverterJobData.InputAnnotationsFileName (this will override it anyway if we give the // document converter a loadDocumentOptions) loadDocumentOptions.AnnotationsUri = new Uri(this.InputAnnotationsFileName); } } converter.LoadDocumentOptions = loadDocumentOptions; // Set options converter.Options.JobErrorMode = this.ErrorMode; if (!string.IsNullOrEmpty(this.PageNumberingTemplate)) { converter.Options.PageNumberingTemplate = this.PageNumberingTemplate; } converter.Options.EnableSvgConversion = this.EnableSvgConversion; converter.Options.SvgImagesRecognitionMode = (this.OcrEngineInstance != null && this.OcrEngineInstance.IsStarted) ? this.SvgImagesRecognitionMode : DocumentConverterSvgImagesRecognitionMode.Disabled; converter.Options.EmptyPageMode = this.EmptyPageMode; converter.Options.UseThreads = this.UseThreads; converter.Diagnostics.EnableTrace = this.EnableTrace; // Set Redaction Options if (redactionOptions != null) { var documentRedactionOptions = new DocumentRedactionOptions(); documentRedactionOptions.ConvertOptions = redactionOptions; if (document != null) { documentRedactionOptions.ViewOptions = document.Annotations.RedactionOptions.ViewOptions; document.Annotations.RedactionOptions = documentRedactionOptions; } else { converter.LoadDocumentOptions.RedactionOptions = documentRedactionOptions; } } }