Acrobat Reader and the decimal comma problem

When printing a PDF file, Acrobat Reader creates a Postscript and sends it to the printer spooler (or, optionally to a file). Nothing new here, as it’s a common way for Unix programs to print files.

However, I found that under certain circumstances the Postscript file was corrupt: it could not be printed or opened with Ghostscript, because it showed instead an “undefined command” error.

Looking deeper into the problem I found that the corrupt file had its decimal numbers separated by a comma instead of a dot. The comma is the decimal separator in many locales, but decimal numbers in Postscript files must be separated by a dot.

Investigating a bit more I found that this problem shows when the Postscript file uses vector primitives, and that’s why the problem appears to occur randomly.

So the problem is that Acrobat Reader relies incorrectly on the locale settings to create a Postscript file. This should be a trivial bug to fix, but as Acrobat Reader is closed software you have to live with it if you want to use this software (fortunately free PDF readers are constantly improving).

There’s a quick workaround, however. As /usr/bin/acroread is really a shell script that lauches the real binary, you can add a export LC_NUMERIC=C at the beginning of the file and solve the problem. This bug is already fixed in some unofficial Debian packages.

Hope it helps.

2 thoughts on “Acrobat Reader and the decimal comma problem

  1. akae

    I was having a problem with spanish enviroment and a pdf with editable numeric fields. acroread was placing the dot and comma where he wanted, i.e. € 100.0,0000 (it should be 1.000,00) and this hint solved it in some way – now i have the dot placed correctly, and 5 decimal! 1.000,00000
    Lots of thanks!

    Reply

Leave a Reply to akae Cancel reply

Your email address will not be published. Required fields are marked *