Answer the question
In order to leave comments, you need to log in
How to add information to a pdf document?
Hello everyone, this is the first time I have encountered such a problem and I ask for your advice.
There is some platform on which, by pressing the corresponding key, a pdf document should be generated. More precisely:
Answer the question
In order to leave comments, you need to log in
The barryvdh/laravel-dompdf package is quite handy to use. What exactly did you not understand?
Below is the code using the package:
$text="Текст";
//создаем инстанс класса от DOMDPF
$pdf = App::make('dompdf.wrapper');
//генерируем название файла
$filename = \Carbon\Carbon::now() . ".pdf";
//загружаем наш view шаблон и в шаблон передаем текст
$pdf->loadView('template.print_fields', compact('text'));
//выводим шаблон в формате pdf на странице.
return $pdf->stream($filename);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question