XMP embedding corrupts CorelDRAW EPS files
|Status:||Closed||Start date:||30 Sep 2011|
|Assignee:||Volker Grabsch||% Done:|
When XMP is embedded into an EPS file generated by CorelDRAW, the resulting EPS file is corrupt and won't open. As of Exiv2 0.22, the only workaround is removing the XMP via "exiv2 -dx".
This issue exists with all CorelDRAW versions from 11 to X5, and possibly also with older versions of CorelDRAW. The resulting file can't be opened with any application, because the problem happens at the level of PostScript code.
Note that this issue is very different from the issue with Illustrator-8 EPS files, where only one application (Illustrator) wasn't able to open the modified EPS file, but all other applications worked perfectly fine with it.
The problem is caused by CorelDRAW's somewhat strange interpretation of the DSC specification. Usually, the PostScript code after %%EndPageSetup leaves the stack in the same state as it started. However, in CorelDRAW's code the first effective PostScript command is "restore" (called by "@rs" called by "@rax"). This works only well if the last command of PageSetup was "@sv" (which calls "save"). However, this is exactly where our XMP embedding code is inserted, in conformance with the XMP specification. So the "restore" undoes some definition of our XMP embedding which leads to an "undefined" error later in the second part of the XMP embedding code (at %%PageTrailer).
In simpler words, the CorelDRAW EPS code expects the last command of %%PageSetup to be "@sv", otherwise it won't work properly.
I think we can improve our embedding code to add some workaround for the special case of CorelDRAW EPS files.