Comments (16)
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.
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.
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.
@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.
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.
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.
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.
Thank you joshuadegier .
from pdf-to-image.
@joshuadegier , I have the same issue, i use window
from pdf-to-image.
Sorry @kennj2016, I'm not working with Windows
from pdf-to-image.
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.
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.
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.
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.
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.
@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)
- Multiple pages overlapped into one image when pdf is loaded from url HOT 4
- PHP 8 compatibility HOT 2
- Call to undefined method Spatie\PdfToImage\Pdf::setCompressionQuality() HOT 5
- Support for PHP 8.1 HOT 4
- PDFDelegateFailed `The system cannot find the file specified. ' @ error/pdf.c/ReadPDFImage/794 http://localhost:8000
- Spatie\PdfToImage\Exceptions\PdfDoesNotExist HOT 1
- PDF with Annotations? HOT 1
- "Pdf::setCompressionQuality()" HOT 3
- Image has a black background color HOT 4
- getNumberOfPages returns wrong number HOT 3
- Image size (width and height) issue HOT 2
- Support for php 8.x HOT 2
- After converting, the file does not open anymore. Message: Something went wrong. HOT 1
- imagick extintion dose now work HOT 7
- FailedToExecuteCommand when trying to ping PDF file HOT 5
- Webp support HOT 2
- Tag new release HOT 6
- " Class 'Imagick' not found" how to solve HOT 3
- Feature request HOT 1
- Text convertion broke
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdf-to-image.