Generating PDF with Laravel [closed]

-1

I'm trying to implement this pdf lib for my Laravel project: link . Since I'm having trouble with the implementation, because its documentation is not very clear with the method I need to use to create a PDF.

    
asked by anonymous 15.09.2018 / 20:27

2 answers

1

To implement, as you are using a framework, I would suggest installing through composer.

First, add the TCPDF dependency to composer.json :

"require": {
    // Aqui terá todas as dependencias do Laravel, coloque em baixo o tcpdf.
    "tecnickcom/tcpdf": "^6.2.13"
}

Then run the command composer install if there is the file composer.lock , otherwise use composer update .

To use TCPDF, it would look something like this:

<?php
// Acredito que não será necessário a etapa abaixo, mas faça o teste com ou sem.
require __DIR__ . '/vendor/autoload.php';

$pdf = new TCPDF();
$pdf->AddPage();
$pdf->Write(1, 'Hello world');

$pdf->Output('hello_world.pdf');

?>

Original Source

Examples of how to use the library here .

    
15.09.2018 / 21:11
0

I recommend you use DOMPdf, which is already widely accepted and used in the Laravel community.

In addition, it is easy to install and has great documentation.

Worth checking out:     link

    
18.09.2018 / 20:30