Convert cdr (Corel Draw) using .net

I find it hard to convert cdr files to jpg for viewing with C # .net. someone told me that cdr files have an embedded bitmap, is there an easy way to extract it?

right now im working a very bad solution from my application, calling uniconvertor to convert to svg and then converting the svg file to jpg using imagemagick. Is there a better way to do this?

+3
source share
3 answers

In the end, I just used com interop to export images, I had to install coreldraw and reference the CorelDRAW 15.0 type library, still not the best solution, but better than the one I used

+2
source

corelDRAW: C:\Program Files (x86)\Corel\CorelDRAW Graphics Suite 13\Programs\CorelDraw.tlb /bin . , .CDR . .cdr .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)
            {

            }
        }
    }


.cdr .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();
    }


+7

I know that the CDR and SDK file format specification is available through the Corel Technology program http://www.corel.com/servlet/Satellite/us/en/Content/1152796559574

0
source

Source: https://habr.com/ru/post/1789269/


All Articles