public static void SetRasterCodecsOptions(RasterCodecs rasterCodecs, int resolution) { // Set up any extra options to use here if (resolution == 0) { resolution = DefaultResolution; } // Set the load resolution rasterCodecs.Options.Wmf.Load.XResolution = resolution; rasterCodecs.Options.Wmf.Load.YResolution = resolution; rasterCodecs.Options.RasterizeDocument.Load.XResolution = resolution; rasterCodecs.Options.RasterizeDocument.Load.YResolution = resolution; if (GetSettingBoolean(Key_DocumentConverter_SavePDFA)) { CodecsPdfSaveOptions pdfSaveOptions = rasterCodecs.Options.Pdf.Save; pdfSaveOptions.Version = CodecsRasterPdfVersion.PdfA; } String domainWhitelist = LoadHtmlDomainWhitelist(); if (!string.IsNullOrEmpty(domainWhitelist)) { CodecsHtmlLoadOptions htmlLoadOptions = rasterCodecs.Options.Html.Load; htmlLoadOptions.DomainWhitelist = domainWhitelist; } // See if we have an options file in the config var value = GetSettingValue(Key_RasterCodecs_OptionsFilePath); value = GetAbsolutePath(value); if (!string.IsNullOrEmpty(value)) { rasterCodecs.LoadOptions(value); } /* In Web API, resources are pulled from a Temp folder. * So rastercodecs needs to be given an initial path that corresponds * to the /bin folder. * There is an after-build target that copies these files from the proper /bin20 folder. */ var binPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath); if (Directory.Exists(binPath) && File.Exists(Path.Combine(binPath, @"Leadtools.Pdf.Utilities.dll"))) { rasterCodecs.Options.Pdf.InitialPath = binPath; } }
public static void InitCodecs(RasterCodecs codecs, int resolution) { // See if we have an options file in the config string rasterCodecsOptionsFilePath = ServiceHelper.GetSettingValue(Key_Raster_OptionsPath); if (!string.IsNullOrEmpty(rasterCodecsOptionsFilePath) && File.Exists(rasterCodecsOptionsFilePath)) { // Load the options codecs.LoadOptions(rasterCodecsOptionsFilePath); } // Set up any extra options to use here if (resolution == 0) { resolution = _defaultResolution; } // Set the load resolution codecs.Options.Wmf.Load.XResolution = resolution; codecs.Options.Wmf.Load.YResolution = resolution; codecs.Options.RasterizeDocument.Load.XResolution = resolution; codecs.Options.RasterizeDocument.Load.YResolution = resolution; }