public static void Run() { // To get proper output please apply a valid Aspose.Imaging License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); //ExStart:SupportForODG // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); string[] files = new string[2] { "example.odg", "example1.odg" }; string folder = @"F:\\Aspose Work\\"; OdgRasterizationOptions rasterizationOptions = new OdgRasterizationOptions(); foreach (string file in files) { string fileName = System.IO.Path.Combine(folder, file); using (Image image = Image.Load(fileName)) { rasterizationOptions.PageSize = image.Size; string outFileName = fileName.Replace(".odg", ".png"); image.Save(outFileName, new PngOptions { VectorRasterizationOptions = rasterizationOptions }); outFileName = fileName.Replace(".odg", ".pdf"); image.Save(outFileName, new PdfOptions { VectorRasterizationOptions = rasterizationOptions }); } } //ExEnd:SupportForODG }
public static void Run() { Console.WriteLine("Running example SupportOfTextRenderingHint"); // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); string[] files = new string[] { "TextHintTest.cdr", "TextHintTest.cmx", "TextHintTest.emf", "TextHintTest.wmf", "TextHintTest.odg", "TextHintTest.svg" }; TextRenderingHint[] textRenderingHints = new TextRenderingHint[] { TextRenderingHint.AntiAlias, TextRenderingHint.AntiAliasGridFit, TextRenderingHint.ClearTypeGridFit, TextRenderingHint.SingleBitPerPixel, TextRenderingHint.SingleBitPerPixelGridFit }; foreach (string fileName in files) { using (Image image = Image.Load(dataDir + fileName)) { VectorRasterizationOptions vectorRasterizationOptions; if (image is CdrImage) { vectorRasterizationOptions = new CdrRasterizationOptions(); } else if (image is CmxImage) { vectorRasterizationOptions = new CmxRasterizationOptions(); } else if (image is EmfImage) { vectorRasterizationOptions = new EmfRasterizationOptions(); } else if (image is WmfImage) { vectorRasterizationOptions = new WmfRasterizationOptions(); } else if (image is OdgImage) { vectorRasterizationOptions = new OdgRasterizationOptions(); } else if (image is SvgImage) { vectorRasterizationOptions = new SvgRasterizationOptions(); } else { throw new Exception("This is image is not supported in this example"); } vectorRasterizationOptions.PageSize = image.Size; foreach (TextRenderingHint textRenderingHint in textRenderingHints) { string outputFileName = dataDir + "image_" + textRenderingHint + "_" + fileName + ".png"; vectorRasterizationOptions.TextRenderingHint = textRenderingHint; image.Save(outputFileName, new PngOptions() { VectorRasterizationOptions = vectorRasterizationOptions }); } } } Console.WriteLine("Finished example SupportOfTextRenderingHint"); }
public static void Run() { Console.WriteLine("Running example SupportOfSmoothingMode"); // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); string[] files = new string[] { "SmoothingTest.cdr", "SmoothingTest.cmx", "SmoothingTest.emf", "SmoothingTest.wmf", "SmoothingTest.odg", "SmoothingTest.svg" }; SmoothingMode[] smoothingModes = new SmoothingMode[] { SmoothingMode.AntiAlias, SmoothingMode.None }; foreach (string fileName in files) { using (Image image = Image.Load(dataDir + fileName)) { VectorRasterizationOptions vectorRasterizationOptions; if (image is CdrImage) { vectorRasterizationOptions = new CdrRasterizationOptions(); } else if (image is CmxImage) { vectorRasterizationOptions = new CmxRasterizationOptions(); } else if (image is EmfImage) { vectorRasterizationOptions = new EmfRasterizationOptions(); } else if (image is WmfImage) { vectorRasterizationOptions = new WmfRasterizationOptions(); } else if (image is OdgImage) { vectorRasterizationOptions = new OdgRasterizationOptions(); } else if (image is SvgImage) { vectorRasterizationOptions = new SvgRasterizationOptions(); } else { throw new Exception("This is image is not supported in this example"); } vectorRasterizationOptions.PageSize = image.Size; foreach (SmoothingMode smoothingMode in smoothingModes) { string outputFileName = dataDir + "image_" + smoothingMode + "_" + fileName + ".png"; vectorRasterizationOptions.SmoothingMode = smoothingMode; image.Save( outputFileName, new PngOptions() { VectorRasterizationOptions = vectorRasterizationOptions }); } } } Console.WriteLine("Finished example SupportOfSmoothingMode"); }