Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save conholdate-gists/7380f6738191770b063d625fa48ee0eb to your computer and use it in GitHub Desktop.

Select an option

Save conholdate-gists/7380f6738191770b063d625fa48ee0eb to your computer and use it in GitHub Desktop.
How to Convert CDR to PNG using API in .NET
using System;
using Conholdate.Total;
namespace CdrToPngDemo
{
class Program
{
static void Main(string[] args)
{
// Validate input arguments
if (args.Length < 2)
{
Console.WriteLine("Usage: CdrToPngDemo <input.cdr> <output.png>");
return;
}
string inputPath = args[0];
string outputPath = args[1];
try
{
// Initialize the conversion engine
var converter = new Conversion();
// Load the CDR document
converter.LoadDocument(inputPath);
// Configure PNG output options
var pngOptions = new PngOptions
{
DpiX = 300,
DpiY = 300,
BackgroundColor = System.Drawing.Color.White
};
// Execute conversion
converter.Convert(outputPath, pngOptions);
Console.WriteLine($"Conversion successful: {outputPath}");
}
catch (Exception 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