0

I have installed the latest version of Ghostscript (9.50) and use it to convert pdf files to version 1.4. It works very well but I have encountered a file that cannot convert. The file is 240kb, without protection, one page, pdf version 1.6. When I start the procedure, an empty 3kb file is created and the web page begins to load indefinitely. My command is:

shell_exec("gswin64 -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -dSAFER -sOutputFile=".$srcfile_new." ".$srcfile."");

Is there any other parameter that I can use? Is it possible to display the error type?

PDF LINK

Sorry for my english.

Francesco
  • 1
  • 2
  • 1
    My first suggestion would be remove the -dQUIET parameter, and see if Ghostscript might be trying to tell you what's happening. Beyond that, it's impossible to even guess without seeing the file in question. Also, it would be better to specify a version rather than "latest", for anyone coming to this thread in the future. – chrisl Jan 17 '20 at 16:16
  • Thanks for reply chrisl. The ghostscript version is 9.50. I tried to remove the parameter -dQUIET but no error message comes out. The browser continues to load indefinitely. I also tried to delete dCompatibilityLevel = 1.4 and -dNOPAUSE, too. The result is always the same. Is there any way to attach the pdf file? – Francesco Jan 20 '20 at 07:28
  • Put the file somewhere public (eg DropBox), and put a link to it here. What **exactly** do you get on stdout and stderr when you run that command from the command line, instead of using shell_exec ? – KenS Jan 20 '20 at 08:12
  • The command line result is ok. The problem is that it creates a corrupt pdf that doesn't work. I attach the pdf to convert [LINK](https://www.dropbox.com/s/yelae0bkti4uy5z/ppp.pdf?dl=0). – Francesco Jan 20 '20 at 12:22
  • I've tried using the above linked file, with the command line further above, and I get a valid, working PDF out. However, I've only tried it on Linux, I can't conveniently try Windows at the moment. – chrisl Jan 22 '20 at 13:42
  • I use ghostscript on windows server 2012. The strange thing is that the conversion works without problems today. I haven't changed anything. I do not understand. For me the practice is solved. Thank you all – Francesco Jan 23 '20 at 11:28

0 Answers0