Created
March 10, 2026 14:53
-
-
Save aspose-com-gists/7edca032f84b937c8289e25861dd7f1f to your computer and use it in GitHub Desktop.
How to Convert CDR to PNG using API in .NET
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using Conholdate.Total; | |
| using Conholdate.Total.Conversion; | |
| using Conholdate.Total.Conversion.Options; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| // Path to the source CDR file | |
| string inputPath = @"C:\Docs\sample.cdr"; | |
| // Path for the generated PNG file | |
| string outputPath = @"C:\Docs\sample.png"; | |
| // Initialize the converter | |
| using var converter = new Converter(); | |
| try | |
| { | |
| // Load the CDR document | |
| converter.LoadDocument(inputPath); | |
| // Set PNG export options | |
| var pngOptions = new PngOptions | |
| { | |
| ResolutionX = 300, | |
| ResolutionY = 300, | |
| BitDepth = 24, | |
| Transparency = true | |
| }; | |
| // Perform the conversion | |
| converter.Convert(outputPath, pngOptions); | |
| Console.WriteLine("Conversion successful. PNG saved to: " + outputPath); | |
| } | |
| catch (ConversionException ex) | |
| { | |
| Console.WriteLine("Error during conversion: " + ex.Message); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment