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.
Download Extension
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.
Error : You need to install the imagick extension to use this back end
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)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us
Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- How to Create Zip File and Download in Laravel
- Laravel 10 CRUD Operation With YouTube Video Tutorial
- Laravel Database Based Dynamic Mail Configuration Set Example
- Laravel Adding Social Media Share buttons Advanced Tutorial Example
- Laravel One to One Eloquent Relationship Tutorial
- Parent OrderBy From Many Child's Laravel Example
- Laravel 9 Telescope Integration Tutorial
- Unique violation: 7 ERROR: duplicate key value violates unique constraint "users_pkey" DETAIL: Key (id)=(1) already exists.
- Import Export Database in JSON Format Laravel
- Laravel 9 Ajax Image Upload With Preview Tutorial