sheshant / pdf2image

Automatically exported from code.google.com/p/pdf2image
0 stars 0 forks source link

"sh: gswin32c: not found" error when running on Linux #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run, eg, "pdf2image filename.pdf -JSON -compress"

What is the expected output? What do you see instead?

pdf2image filename.pdf -JSON -compress
Page-1
Page-2
Page-3
Page-4
Page-5
Page-6
Page-7
Page-8
Page-9
Page-10
Page-11
Page-12
sh: gswin32c: not found
Error: Failed to launch Ghostscript!

What version of the product are you using? On what operating system?

Version 0.49, on Ubuntu 64bit 11.04.

Please provide any additional information below.

Something is clearly wrong here; gswin32c is the name of the GS binary on 
Windows.  

As an editorial: In addition, I ran into the same problems reported as defects 
in Issues #2 and #3, in that I had to manually tweak goo/gfile.h with my own 
#include <sys/dir.h>, and had to tweak splash/Makefile to override the default 
hard-coded /usr/local/include cflag.  The build completed with a LOT of 
deprecation notices, eg. "pdf2image.cc:122:72: warning: deprecated conversion 
from string constant to ‘char*". It would be very nice if the source version 
of this package was distributed with `configure' support and, additionally, if 
binary packages (debs, rpms, msi) were made available for the major target 
platforms (Debian/Ubuntu, Redhat/CentOS, Windows).

Original issue reported on code.google.com by br...@intercarve.net on 13 May 2011 at 1:58

GoogleCodeExporter commented 8 years ago
Update: A quick grep for 'gswin32' shows that in aconf.h, there is a 
hard-coded: #define GHOSTSCRIPT "gswin32".  Changing this to "gs" and 
re-compiling solves the problem.

Original comment by br...@intercarve.net on 13 May 2011 at 2:04

GoogleCodeExporter commented 8 years ago
Same problem. same issue. it work's now. thanks br...@intercarve.net

Original comment by vincent....@gmail.com on 19 May 2011 at 12:06

GoogleCodeExporter commented 8 years ago
Update:  even after I changed 'gswin32' to 'gs' in aconf.h, pdf2image does not 
run properly:

../../src/pdf2image/src/pdf2image D5WjS8ERKb.pdf 
Page-1
Page-2
Page-3
Page-4
Page-5
Page-6
Page-7
Page-8
Page-9
Page-10
Page-11
Page-12
Page-13
Page-14
Error: /ioerror in --image--
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop   1861   1   3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1782   1   7   %oparray_pop
Dictionary stack:
   --dict:1158/1684(ro)(G)--   --dict:0/20(G)--   --dict:71/200(L)--   --dict:65/75(L)--   --dict:18/25(L)--   --dict:0/15(L)--   --dict:0/15(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 13358
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
Error: Failed to launch Ghostscript!

Original comment by br...@intercarve.net on 20 Jun 2011 at 4:57

GoogleCodeExporter commented 8 years ago
I'm having the same issue with RHEL 6.1 and pdf2image.

Error: /ioerror in --image--
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1862   1   3   %oparray_pop   1861   1   3   %oparray_pop   1845   1   3   %oparray_pop   1739   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1766   1   8   %oparray_pop
Dictionary stack:
   --dict:1156/1684(ro)(G)--   --dict:0/20(G)--   --dict:71/200(L)--   --dict:71/75(L)--   --dict:18/25(L)--   --dict:0/15(L)--   --dict:0/15(L)--   --dict:0/15(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 6573993
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
Error: Failed to launch Ghostscript!

Original comment by tech...@gmail.com on 8 Sep 2011 at 6:55

GoogleCodeExporter commented 8 years ago
Same issue here.

pdf2image FLEXUI_LICENSE.pdf -JSON -compress
Page-1
Page-2
Error: /undefined in $F
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1161/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:65/75(L)--   --dict:18/25(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 350406
GPL Ghostscript 9.01: Unrecoverable error, exit code 1
Error: Failed to launch Ghostscript!

Original comment by cajay...@gmail.com on 30 Sep 2011 at 9:45

GoogleCodeExporter commented 8 years ago
same issue here .

[root@localhost splash]# pdf2image /root/tempalte/tao/confirmation.pdf -JSON 
-compress
Page-1
Error: /ioerror in --image--
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1846   1   3   %oparray_pop   1845   1   3   %oparray_pop   1829   1   3   %oparray_pop   1723   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1750   1   7   %oparray_pop
Dictionary stack:
   --dict:1156/1684(ro)(G)--   --dict:0/20(G)--   --dict:71/200(L)--   --dict:65/75(L)--   --dict:18/25(L)--   --dict:2/15(L)--   --dict:0/15(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 13337
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
Error: Failed to launch Ghostscript!

Original comment by nguyenho...@gmail.com on 24 Nov 2011 at 9:56

GoogleCodeExporter commented 8 years ago
Pretty sure this software is unmaintained...

Original comment by br...@intercarve.net on 27 Nov 2011 at 3:21

GoogleCodeExporter commented 8 years ago
Yeah it seems that no-one is maintaining this code.

However, I have managed to fix this bug as I had the same Ghostscript error as 
the previous few comments.

The problem is that pdf2image creates a ps file that Ghostscript can't handle. 
However, if you give Ghostscript the original PDF file instead, that works fine 
and your PNGs will be created fine (the default zoom of 1.5 isn't great though, 
for my purposes at least, but this easy enough to change)

I don't know how to check in my fixes, this is the first time I have 
contributed anything, but here is what I did:

edit the file: src/pdf2image.cc

Comment out or delete lines 298-302 (psOut = ... to delete psOut;)
Replace line 323:
old 323: gsCmd->append(psFileName);
new 323: gsCmd->append(fileName);
(fileName is just your PDF filename, whereas psFilename is the .ps file that 
got created in the lines you have commented out, that GhostScript doesn't like)

Replace line 329:
old 329: unlink(psFileName->getCString());
new 329: unlink(htmlFileName->getCString());
(htmlFileName is an empty file with the same name as your PDF, but with no 
extension, the purpose of which I don't know...)

If you like, you can get the GhostScript command directly, just output 
gsCmd->getCString() around line 325.

make and make install and you should be away.

How to improve the resolution of the output file: you are looking for the 
variable called "scale", or alternatively change the number 72 in line 309 to a 
higher number. I guess the author thought 72 was good enough for screen 
resolution, and a scale of 1 would be OK - but it isn't for me, and maybe not 
for you.

I hope this helps someone!

Cheers
Tim

Original comment by timtheco...@gmail.com on 30 Nov 2011 at 4:19

GoogleCodeExporter commented 8 years ago
P.S. Re "scale", I just realised that you can just do -zoom <x> as an option to 
pdf2image, no need to change "scale" in the code unless you really want to...

Original comment by timtheco...@gmail.com on 30 Nov 2011 at 4:27

GoogleCodeExporter commented 8 years ago

Original comment by pdf2im...@devaldi.com on 9 Jan 2012 at 1:10