Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract text from PDF with Ghostscript - Unknown device: txtwrite

i'm trying to extract the text from a PDF. I'm working with Ghostscript but when i run the command below

gs -dBATCH -dNOPAUSE -sDEVICE=txtwrite mypdf.pdf

an error occurs. This one below.

Unknown device: txtwrite
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
             defaultdevice

Any idea about it? Isn't txtwrite a default ghostscript device ?

This is the output of gs -v

GPL Ghostscript 8.70 (2009-07-31)

and that one the OS Version CentOS release 5.8 (Final).

like image 267
alesdario Avatar asked Mar 09 '26 02:03

alesdario


1 Answers

The txtwrite device was introduced to Ghostscript in 9.05 if I remember correctly (current version is 9.06). 8.70 is really quite old and much too old to include this device.

Upgrade to a more recent version.

like image 134
KenS Avatar answered Mar 11 '26 21:03

KenS