Create PDF / PDF in Laravel

I am creating a PDF DOM in laravel using the barryvdh / laravel-dompdf package . It works great by creating HTML views and elements with readonly mode. But I'm trying to create a fillable / editable PDF so that the user can enter data by opening it in third-party editors.

Below is the code snippet that I use to create a PDF file with the barryvdh / laravel-dompdf package.

    $file = "Storage/pdf/document.pdf";
    $data = array("foo" => "bar");
    $view = view('pdf.document', $data);
    \PDF::loadHTML($view)->setPaper('A4', 'portrait')->setWarnings(false)-save($file);

I also tried mpdf niklasravnsborg / laravel-pdf , but it also opens in readable mode.

    $data = [
        'foo' => 'bar'
    ];
    $pdf = PDF::loadView('pdf.document', $data);
    return $pdf->stream('document.pdf');

Please suggest me adjust the settings for this code.

+4
source share
3 answers

PDF dompdf <, , :

Dompdf PDF, .

niklasravnsborg/laravel-pdf, mpdf, PDF .

mpdf.

, html :

<h2>Active Forms</h2>
<form action="formsubmit.php" method="post">
  <b>Input Text</b>
  <input type="text" size="90" name="inputfield" value="" title="The title attribute works like a tool-tip" />
</form>

laravel-fpdf package, FPDF.

+6

FPDF. , PDF . , pdf-.

0

There is a problem with niklasravnsborg / laravel-pdf in my laravel application.
My blade:

<h2>Active Forms</h2>
<form action="formsubmit.php" method="post">
  <b>Input Text</b>
  <input type="text" size="90" name="inputfield" value=""/>
</form>

My controller:

Use PDF
$ pdf = PDF :: loadView ('mia.show_pdf');
$ pdf-> useActiveForms = true;
return $ pdf-> stream ('mia.pdf');

The PDF is generated correctly, but the input field is not populated.

0
source

Source: https://habr.com/ru/post/1695340/


All Articles