Support for Corel DRAW files in free software gets another chance

Support for Corel DRAW files in free software gets another chance

LibreOffice project started working on a new C++ library to take care of your legacy Corel DRAW files. Calligra Suite team is following closely.

Let's face it: in nearly five years UniConvertor hasn't gotten much further than reading pages, paths, fills and strokes from Corel DRAW files. Whatever reasons the sK1 team has, we haven't seen a lot of progress in a long time there.

Last year truly yours re-lab team did some more reverse-engineering of CDR files again, while moving the CDR parser to OLE Toy — an in-house tool that we earlier created for peeking inside various binary files.

The new information we discovered wasn't put to any real use which was somewhat discouraging. However in late November Fridrich Strba of LibreOffice fame came to aid and wrote some initial code for the a library to read CDR files.

Active work on libcdr started only last week, yet the first version of the library was released yesterday with a very basic support for CDR files.

What's in the library

Much like libvisio, the new library provides a parser and a basic converter to SVG that saves SVG images embedded to XHTML documents. If it finds multiple pages (which Corel DRAW supports), it will save them one after another in the same XHTML document.

What works

Currently the library reads only v7-v13 files and converts basic shapes such as paths, rectangles, ellipses, “pies” and elliptical arcs along with some color fills. Polygons are a tricky part, but we are working on deciphering them. Strokes are a work in progress as well, but basic support is there already.

Some bugs such as reading page size and rectangle orientation were fixed in Git after the release of libcdr 0.0.1. So here is an advice: if you are willing to follow development of libcdr, pull the source code from Git.

The hard part

First of all, let's get it straight from ground up: there will be certain limits to what you will be able to transfer. E.g. neither OpenDocument nor SVG have rectangles with arbitrary rounded corners.

Rounded rectangle in Corel DRAW

So what cdr2xhtml currently does is creating a Bezier path out of such a rectangle.

Rounded rectangle from CDR in Inkscape

For just displaying legacy clipart this should be sufficient.

Another question is, of course, what's going to happen to CMYK and spot color values. OpenDocument has a notion of CMYK color values, but you can only find it in UI for fills of objects. So Fridrich will probably have to implement a CMYK to RGB converter in the library. Currently it is an open question.

As for SVG, it supports CMYK only via the icc-color workaround which is actually quite OK, because Corel DRAW seems to do a similar thing (it even embeds color profiles to CDR files). And upcoming SVG2 is going to have uncalibrated device colors so you'll be able to just use raw CMYK values.

In other words, it looks like libcdr should just read whatever it can and let end-user software decide which parts of API to use and how to treat various elements.

The future

The plan is that Fridrich will do some more PR for the project at FOSDEM this weekend and is going to keep writing code regardless. Meanwhile re-lab team will keep assisting with reverse-engineering.

How to fetch, build and use

The procedure is pretty much like the one for libvisio. For details please have a look at the end of the Visio/LibreOffice story where it's explained in details.

Essentially, you just fetch the code from Git:

$ git clone git://

Build it:

$ ./ && ./configure && make && sudo make install

And use the converter:

$ cdr2xhtml file.cdr > file.xhtml

Then use a text editor of your choice to cut embedded SVG documents to standalone files.

As usual, expect updates.

But hey! Calligra Suite?

Yes,  Friedrich Kossebau, a contributor to Calligra Suite, is working on his very own CDR importer for Karbon. He implemented a RIFF parser for Qt and wrote an importer for CDR files on top of it.

Initial CDR importer for Karbon

As you can see, importing paths works right now. Libkoralle, the library for parsing RIFF data, is publicly available too. Three projects for just extracting useful data from one file format is probably a bit too much, but let's see how things work out in the end.

Was it useful? There's more:


Leave a comment
  1. I really wish a work like this could be done to read multi-layered png’s and transfer/convert them to svg.

    As far as I know, Adobe Fireworks is the only program that is able to create and read thos files. No converter or reader exists for it. A lot of webdesigners use this program and to be able to see these files or edit them, you need to buy Adobe Fireworks…

  2. Alexandre Prokoudine 03 February 2012 at 2:22 pm

    Multilayered PNG? Are yiou referring to APNG?

  3. I have no idea if there is a special name for them.

    Other programs (including Adobe’s own) can only see the first layer in them. To view the rest, you need Adobe Fireworks.

  4. Alexandre Prokoudine 03 February 2012 at 2:33 pm

    Well, you’ve just introduced me to something new :) How high is the demand?

  5. Glad I could do that!

    Impossible for me to judge regarding demand. But I know a lot of people that has this problem. We work with others that refuse to use anything else than Fireworks (and you can not always choose who you work with…) and they only store their work as layered png’s. I know others that use Inkscape for the same kind of design work. A way to get things from Fireworks to Inkscape would be fantastic!

    The layered png must be one of the most closed formats I know…

  6. Friedrich Kossebau 03 February 2012 at 3:34 pm

    Heya, got pointed to this page with my name in it :) To correct some things: I am not a member of the Calligra Suite team, rather kind of external contributor so far. And I only found out about libcdr once I already had my code working similar to the state as seen in the screenshot :)
    And libkoralle was factored out of the code I had as it this part seemed useful for others in any way.
    Just mentioning this to have facts straight, dear Alexandre ;) Never hesitate to check your facts, please.

    That there are three different projects must not mean bad things, the hard part is finding out the format/byte layout of the cdr format. Parsing that and turning into the target data model, which is actually a different one for each project,  is rather straight-forward work. So having different projects has also some reason. Having said that, I watch libcdr now closely and still consider if and how I join the work there. The future is wide open. But so far I have fun with my own project, and fun (and being able to read my old files) is what I am in here for :)

  7. Alexandre Prokoudine 03 February 2012 at 6:41 pm

    Ah, hello and welcome :)

    Well, that wasn’t entirely clear from the announcement, so thanks for pointing out :) I’ve changed the text. Please let me know if more changes are required.

  8. Friedrich Kossebau 03 February 2012 at 7:15 pm

    Yes, am fine with the content now, thanks for updating, nice move :)

  9. Svein, could you provide a sample file and screenshot(s) how it’s supposed to looks like?

  10. The arbitrary rectangles can be used in ODF. Via a custom shape it’s possible to create that.

  11. Emmanuel Mahuni 27 August 2012 at 12:40 pm

    Hi all

    What i am really interested in is creating coreldraw files for use with coreldraw. I am creating a workflow process where non coreldraw users are supposed to create fomatted text for entry into coreldraw. i want to automate the process in my application and be able to just take the provided title, text, and other info and create a ready to work with coreldraw file. this may be used by printers or originators etc.

    is this lib able to do that?


  12. Alexandre Prokoudine 27 August 2012 at 7:22 pm

    Unfortunately libcdr doesn’t yet provide API for saving CDR files.

  13. #Mahuni

    Actually, the problem for us is in the reverse;
    We have switched to open source but the beaureau guys are still with Coreldraw and just wouldn’t move.

    So while we create documents in Open Source (Gimp say) we have to hand it to the beaureau in eps.

    The blighters there want it in .cdr; any attempts at teaching them to even dual boot is misery.

    These people will benefit from Mahuni’s idea.

    Thanks for the great job!  Good Luck!

  14. I want free trail for a month, try as subtitute of autocad

Tell us what you think

Submit the word you see below: