Articles > Latex

I was having a problem where I couldn’t use ps2ascii on one of my Postscript files:

> ps2ascii  1>partial-test.txt
MiKTeX GPL Ghostscript 8.60: Unrecoverable error, exit code 1

I looked into the output, and it was displaying:

Error: /undefined in --.noteimage--

This Postscript file was being generated as part of my Latex compilation script. In particular, it had an image at the location it was failing, which was originally a SVG image exported into Postscript.

It turned out that the problem was that the image was being exported to PS Level 3, not PS Level 2. So one solution is to export your image at PS Level 2.

However, I didn’t have this option available. So instead I wrote a PHP script to strip Cairo images from the PS file, allowing it to be successfully passed to ps2ascii.

This script can then successfully be used to strip the Cairo-generated images away from the postscript.

$ php -f strip_cairo_images.php >
$ ps2ascii > stripped.txt