Polishing Adobe Illustrator results

Adobe Illustrators seems to be a very good tool, even although I've never used it. Unfortunately, I have problems with AI results exported as SVG and EPS.

One can't directly use SVG produced by AI due to wrong namespaces. I had to write a program, which corrects some issues I found:

* The program changes DOCTYPE with some old SVG public identifier to just "<!DOCTYPE svg [".
* The default namespace is set: xmlns="http://www.w3.org/2000/svg"
* The namespace for xlink is defined: xmlns:xlink="http://www.w3.org/1999/xlink"

Another set of problems can be found in EPS files. My users must have EPS with preview images. Unfortunately, epstopdf fails on such files. After some investigations I found that what AI produces is not an EPS file, but a DOS EPS file with some binary header.

To extract PostScript from a DOS EPS file, I found the program "epstool". The most part of EPS files, filtered by epstool, is accepted by epstopdf.

Unfortunately, epstool rejects some DOS EPS files. I found out that it's because such files contain "%Trailer" too far from the end of the stream and "%EOF" isn't at the end of the stream. I don't know why. To workaround the problem, I patched epstool source code to lower severity of the error. Now conversion works well.

The patch file to use with "patch -p1":

diff -Naur epstool-3.08.orig/src/dscparse.c epstool-3.08/src/dscparse.c
--- epstool-3.08.orig/src/dscparse.c    2005-06-10 13:41:00 +0400
+++ epstool-3.08/src/dscparse.c 2006-02-18 10:36:17 +0300
@@ -135,8 +135,8 @@
 /* DSC error reporting */
 dsc_private const int dsc_severity[] = {
     CDSC_ERROR_WARN,   /* CDSC_MESSAGE_BBOX */
-    CDSC_ERROR_WARN,   /* CDSC_MESSAGE_EARLY_TRAILER */
-    CDSC_ERROR_WARN,   /* CDSC_MESSAGE_EARLY_EOF */
+    CDSC_ERROR_INFORM,         /* CDSC_MESSAGE_EARLY_TRAILER */
+    CDSC_ERROR_INFORM,         /* CDSC_MESSAGE_EARLY_EOF */
     CDSC_ERROR_ERROR,  /* CDSC_MESSAGE_PAGE_IN_TRAILER */
     CDSC_ERROR_ERROR,  /* CDSC_MESSAGE_PAGE_ORDINAL */
     CDSC_ERROR_ERROR,  /* CDSC_MESSAGE_PAGES_WRONG */
Categories:

Updated: