Import of Poppler code from http://poppler.freedesktop.org/