Convert cdr (Corel Draw) using .net
Solution 1
In the end i just used com interop to export the images, had to install coreldraw and reference the CorelDRAW 15.0 Type Library, still not the best solution but better then the one i was using
Solution 2
You will need to copy the type library from corelDRAW: C:\Program Files (x86)\Corel\CorelDRAW Graphics Suite 13\Programs\CorelDraw.tlb
into your /bin
folder and create a reference to it. Once you have done this you should be able to export .CDR files to many different formats. The sample code below converts .cdr to .png.
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CorelDRAW;
namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
CorelDRAW.Application cdr =
new Application();
cdr.OpenDocument(@"C:\Users\user\Desktop\500074.cdr", 1);
cdr.ActiveDocument.ExportBitmap(
@"C:\Users\user\Desktop\newImage.png",
CorelDRAW.cdrFilter.cdrPNG,
CorelDRAW.cdrExportRange.cdrCurrentPage,
CorelDRAW.cdrImageType.cdrRGBColorImage,
0, 0, 72, 72,
CorelDRAW.cdrAntiAliasingType.cdrNoAntiAliasing,
false,
true,
true,
false,
CorelDRAW.cdrCompressionType.cdrCompressionNone,
null).Finish();
cdr.ActiveDocument.Close();
cdr.Quit();
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
This code would convert the .cdr to .pdf:
protected void Button2_Click(object sender, EventArgs e)
{
CorelDRAW.Application cdr =
new Application();
cdr.OpenDocument(@"C:\Users\user\Desktop\500074.cdr", 1);
cdr.ActiveDocument.PublishToPDF(@"C:\Users\user\Desktop\NewImage.pdf");
cdr.ActiveDocument.Close();
cdr.Quit();
}
Dangling
Updated on June 28, 2022Comments
-
Dangling almost 2 years
Im having a hard time converting cdr files to jpgs for previews using c#.net. someone told me that cdr files have embedded bitmap, is there an easy way to extract it?
right now im running a realy bad solution of, from my application, calling uniconvertor to convert to svg, then converting the svg file to jpg using imagemagick. is there a better way to do this?
-
Admin over 13 yearsWell I can't convert your
cdr
using .Net, but I think I can convert yourcar
.
-
-
Dangling over 13 yearsi realy dont want to develop something from the ground up, i just need a thumbnail from the cdr file, the above solution works, but its far from a good solution
-
Parv Sharma about 10 yearsi was earlier using .Convert but that was throwing an exception