Answer the question
In order to leave comments, you need to log in
Why doesn't require work?
My code snippet where I am trying to use the fpdf library to work with pdf files. The thing is, I am getting the following error Class 'app\models\FPDF' not found. If you refuse to use the namespace, everything becomes fine, but my main code is built on this. How to get around this problem?
namespace app\models;
use Yii;
use yii\base\Model;
require('.\..\vendor\setasign\fpdf\fpdf.php');
$envelope = __DIR__ .'\images\konvert-6.jpg';
$img = ImageCreateFromJPEG($envelope);
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Image($envelope,60,30,90,0);
$pdf->Output();
Answer the question
In order to leave comments, you need to log in
composer require setasign/fpdf:^1.8
in the console
in the code For review
use setasign\Fpdf
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question