binary does not exist; binary does not exist in laravel, If you are getting this error while you working with the "anam/phantommagick" package in laravel for the convert pdf to image file or any other development, That time you get this type of error.
The reason for this error is, You not getting a binary path for the execute command line from your laravel application, So in this case, we need to define a binary path ourselves.
First, we will download the exe file from the official site link below given in the step just download a file from there and give a path to the binary method.
First, We will download the extension file from the below-given link, Just click on the below link you will redirect to the download page. Then after downloading suitable your system from there. Download PhantomJS After downloaded, put any of directory of your system. and copy file path inside the bin folder.
Install Composer (If Not Installed)
composer require anam/phantommagick
Give Binary Path
Give your binary path to your "Converter" class using the "setBinary" method, inside.
In my case my "phantomjs.exe" file is inside my c drive, So I given that path.
$conv = new \Anam\PhantomMagick\Converter(); $conv->setBinary('C:\phantomjs-2.1.1-windows\phantomjs-2.1.1-windows\bin\phantomjs.exe');
You can also put that exe file inside your project and give a path something like the below-given example.
$conv = new \Anam\PhantomMagick\Converter(); $conv->make('https://webappfix.com') ->setBinary(base_path() . "/phantomjs-2.0.0-windows/bin/phantomjs.exe") ->toPdf() ->download('google.pdf');
We always thanks to you for reading our blogs.
Dharmesh Chauhan(Swapinfoway Founder)
We Are Also Recommending You :
- How to send mail example in Laravel 6
- Laravel 6 - Preview and Crop Image Before Upload using Ajax
- Laravel Custom Command Make Example
- Laravel 9 File manager integration tutorial
- Laravel 6 Cron Job Task Scheduling Tutorial
- How To Generate Digital Invoice PDF In Laravel Demo
- Laravel debugbar install
- How To Get Last Record From The Laravel Collection Using last() Collection Method Possible all Example
- resize image and upload example laravel intervention
- How To Clone Laravel