Error on export to PDF with Maatwebsite - laravel-5

I want to export to PDF in Laravel 5.5 with maatwebsite/laravel-excel. When I try to export to excel it works. But when I export to PDF I get this error:
Unable to load PDF Rendering library
I've tried to change the entry in composer.json from "dompdf/dompdf": "^0.8.1" to "dompdf/dompdf": "0.6.2" without success.

Laravel-excel is deprecated.
You should use snappy https://github.com/barryvdh/laravel-snappy with wkhtmltopdf https://github.com/wkhtmltopdf/wkhtmltopdf

Related

How to make docx2pdf work on Google Colab to convert Docx to PDF automatically

I am getting following error when I tried to convert docx to PDF using docx2pdf imported from docx
Google colab code:
!pip install docx2pdf
from docx2pdf import convert as doc2pdf
doc2pdf('My_document.docx')
Present output:
docx2pdf is not implemented for linux as it requires Microsoft Word to be installed
If it cannot work, can you suggest another package that I can use to convert the docx to PDF on the Google colab automatically?

Extract text from pdf not working in Laravel

I am trying to extract some text from a PDF file in Laravel using Spatie-PdfToText. However, I get the error no such file or directory. The function is in this path app\Http\Controllers\AddRecordsController and the PDF in this path \app\Http\Controllers\book.pdf.
I've also tried changing the path in getText() to the path written above but same error.
Code to extract:
public function readPDF(){
echo Pdf::getText('book.pdf'); //returns the text
}
Can anyone assist me?
in first you need instal binary library.
if you use Ubuntu or Debian:
apt-get install poppler-utils
or if use RedHat or CentOS:
yum install poppler-utils
After it install library via composer:
composer require spatie/pdf-to-text
Then use it in your controller:
use Spatie\PdfToText\Pdf;
...
echo Pdf::getText('/path/to/file.pdf');

Maatwebsite Excel load function not working

$file = $request->file('excel');
$reader = Excel::load($file->getRealPath())->get();
The following error appears:
Call to undefined method Maatwebsite\Excel\Facades\Excel::load()
I am using Maatwebsite 3 in laravel 5.7
The load method has been removed as quoted in the las post, however it has been already implemented in 3.1 version.
Excel::load() is removed and replaced by Excel::import($yourImport)
Checkout this link
Personally, I ended it up using Excel::toColletion($file) though.
^3.0 versions of maatwebsite/excel does not support loads.
Delete the config/excel.php file first .
Downgrade the maatwebsite/excel version by changing your composer.json
"maatwebsite/excel": "^3.1", to "maatwebsite/excel": "~2.1.0"
perform composer update.
And if you get an error "Undefined class constant 'XLSX' in 2.1 version",this is what you have to do .
delete the config/excel.php before downgrading
then perform composer update.
The load method has been removed in version 3.0 (may be re-added in 3.1). Please refer the upgrade guide
ALL Laravel Excel 2.* methods are deprecated and will not be able to
use in 3.0 .
Excel::load() is removed and will not be re-added until 3.1
Excel::create() is removed and replaced by Excel::download/Excel::store($yourExport)
v3.0 provides no convenience methods for styling, you are encouraged to use PhpSpreadsheets native methods.

How to use setasign fpdi v2.0.0 in Laravel 5.2.* or higher?

I want to edit some pdf file with setasign fpdi,
When it was fpdi still in version 1.6.* i use this way to use it :
I install it via composer
composer require setasign/fpdf & composer require setasign/fpdi
And i use it in Laravel controller :
$pdf = new \FDPI();
$pdf->setSourceFile('PATH/TO/SOURCEFILE');
$pdf->Output();
It work for fpdi version 1.6.* (Legacy)
But when i use the fpdi v2.0.0 and i call the fpdi class in controller using
$pdf = new \FPDI();
it give an error message "Could find FPDI class" from Laravel
Any advice on how to use fpdi v2.0.0 in Laravel5?
Thank you in advance.
Version 2 uses namespaces:
$pdf = new \setasign\Fpdi\Fpdi();
A full migration guide is available here.

how to fix error in laravel 5.2

i just doing now laravel 5.2 steam authentication
i am followed this link
https://github.com/invisnik/laravel-steam-auth## Heading ##
i got a error in composer
"Invisnik\LaravelSteamAuth\SteamServiceProvider::class class not a found"
i have add the composer.json file in
"invisnik/laravel-steam-auth": "2.*"
and composer install and then add
app.php
Invisnik\LaravelSteamAuth\SteamServiceProvider::class,
but this error will be display
"Invisnik\LaravelSteamAuth\SteamServiceProvider::class class not a found"
how can fix this error.
You need to import the class or declare it on the fly using by adding a backwards slash
\SteamServiceProvider
Eg:
\SteamServiceProvider::method()
And if you are adding a new package, make sure to run the following composer command to recatch the files.
composer dump-autoload

Resources