Git Product home page Git Product logo

Comments (16)

joshuadegier avatar joshuadegier commented on May 31, 2024 27

Might be the same issue as I faced this afternoon. Are you testing this locally on your mac? If so, it's possible that apache can't access the ghostscript path. It's located in /usr/local/bin/gs and it should be symlinked to /usr/bin/gs by running this command: sudo ln -s /usr/local/bin/gs /usr/bin/gs.

If you face any permission errors while creating the symlink, please follow the steps as mentioned in the accepted answer for this question on Stackoverflow: https://stackoverflow.com/questions/37927247/imagick-dont-open-pdf-files-with-failed-to-read-the-file-exception

Please let us know if this fixed your issue.

from pdf-to-image.

slashequip avatar slashequip commented on May 31, 2024 6

Holy shit. I love you.

Can't believe I hadn't seen this SO question (after hours of pulling my hair out). Had to do the funky recovery mode stuff but it worked first time after adding in that symlink.

Might be worth a foot note in the readme, seems like it could be a pain point for certain Mac users? Both iMagick and GhostScript were installed via HomeBrew so could be the issue? ¯\_(ツ)_/¯

You sir are on my 'owe you a beer' list.

from pdf-to-image.

joshuadegier avatar joshuadegier commented on May 31, 2024 2

Great to hear, glad I could be of any help. Enjoy working on your application and I'll make sure I don't forget about that beer ;-)

from pdf-to-image.

joshuadegier avatar joshuadegier commented on May 31, 2024 2

@vimalmistry Are you sure ghostscript is installed? Maybe it installed in a different path for you. You might want to try which gs to find out in what directory ghostscript is located. Then replace /usr/local/bin/gs with the path you get from that command.

from pdf-to-image.

Vitch612 avatar Vitch612 commented on May 31, 2024 2

better late than never: with the latest pdf-to-image at the time of writing 2.2.0 (on windows) all that is needed is installing ghostcript renaming or copying the command line executable (in my case gswin64c.exe) to gs.exe and adding the location of that executable to the windows path.

from pdf-to-image.

youngbobby avatar youngbobby commented on May 31, 2024 2

If you're using Laravel Herd, the php-fpm.conf file you're looking for should be located here: ~/Library/Application\ Support/Herd/config/fpm

Basically:

cd ~/Library/Application\ Support/Herd/config/fpm

and then (in my case)

nano 8.2-fpm.conf

and then add to the end of the line:

env[PATH] = /usr/local/bin:/usr/bin:/bin

If you're using Homebrew, the env path would probably be:

env[PATH] = /opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin

from pdf-to-image.

58bits avatar 58bits commented on May 31, 2024 1

I also owe you a beer. Thanks - sudo ln -s /usr/local/bin/gs /usr/bin/gs worked for us too.

from pdf-to-image.

penrcz avatar penrcz commented on May 31, 2024

Thank you joshuadegier .

from pdf-to-image.

kennj2016 avatar kennj2016 commented on May 31, 2024

@joshuadegier , I have the same issue, i use window

from pdf-to-image.

joshuadegier avatar joshuadegier commented on May 31, 2024

Sorry @kennj2016, I'm not working with Windows

from pdf-to-image.

vimalmistry avatar vimalmistry commented on May 31, 2024

Hi, I am facing this same issue. But I am using nginx with php fpm. I tried
sudo ln -s /usr/local/bin/gs /usr/bin/gs
But not working

from pdf-to-image.

cicsolutions avatar cicsolutions commented on May 31, 2024

Sorry to piggyback on an older post, but this looks like the place to present my question. I too am getting the FailedToExecuteCommand 'gs' error. I installed imagemagic and ghostscript with Homebrew, and when I check the path to gs with which gs, I receive /usr/local/bin/gs.

I'm on a mac, not familiar with FPM (don't think I'm using it), and in my .bash_profile file, I've added /usr/local/bin:/usr/bin:/bin to my export PATH.

When I try to run the above suggested symlink sudo ln -s /usr/local/bin/gs /usr/bin/gs, I am receiving the following message ln: /usr/bin/gs: Operation not permitted

I'm really not very educated on all of this ... can anyone point me in the right direction? Thanks so much!

from pdf-to-image.

joshuadegier avatar joshuadegier commented on May 31, 2024

You might want to follow this: https://stackoverflow.com/questions/32659348/operation-not-permitted-when-on-root-el-capitan-rootless-disabled

Don't forget to re-enable csrutil afterwards if it fixed your problem.

from pdf-to-image.

cicsolutions avatar cicsolutions commented on May 31, 2024

Thank you so much @joshuadegier. I see in the thread you shared that I can disable csrutil, make the symlink and then re-enable csrutil, however there is another answer on the thread that says a better solution is to install in the /usr/local/bin directory rather than the /usr/bin directory. It seems hombrew has already done this, so shouldn't there be a way to reference ghostscript in the /usr/local/bin directory that doesn't require symlinking the files to /usr/bin? I would have thought placing /usr/local/bin/gs in my bash_profile export PATH is the way to tell my system where to look for ghostscript, but I'm still learning :)

I'm just trying to understand things better, but perhaps having the files located in /usr/bin is what the spatie-pdf package requires? Just thought I'd ask before trying the csrutil disable/symlink/enable approach. Thank you so much for your help.

from pdf-to-image.

joshuadegier avatar joshuadegier commented on May 31, 2024

I have honestly no idea wether or not Spatie's package relies on ghostscript being in /usr/bin/gs. If it wasn't I suppose it should also work without a symlink being created at all..

I suppose it's possible for your PHP version to have different include paths compared to your CLI. Looking at the documentation there's an option to add the execution path to PHP as well (See https://github.com/spatie/pdf-to-image#issues-regarding-ghostscript)

from pdf-to-image.

davidlapham avatar davidlapham commented on May 31, 2024

@youngbobby thanks for that! I was trying to get it to work with Herd. Still having issues on production though (using Forge)

from pdf-to-image.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.