Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LucKa's avatar
Level 1

Fill PDF template

Hi!

I have tried to find a laravel 6 package to fill in fields in existing pdf templates but so fare I have not found any working package.

  • Dompdf, not possible to fill in PDF forms, just create pdf
  • Fpdf packages such as anouar/fpdf, I have tried different php packages put not been able to get it to work. (problem such as eg; don't install illuminate/support 5.5.x-dev|don't install laravel/framework v7.2.0" when trying to run "composer require " -Mpdf, also no luck

Question: Does it exist a working laravel 6 packages that make it possible to fill in data to existing PDF forms/template?

Best regards, Luc

0 likes
5 replies
LucKa's avatar
Level 1

Hi!

Thx for the advice, unfortunately html2pdf does not support to fill in fields/forms in existing pdf-files/templates.

Are there any other package that support to fill in data to existing PDF-files. (to write data to fields in an existing PDF-file.

Best regards, Luc

Hondaman900's avatar

@LucKa, did you find a solution for this? I had been using the Laravel package mikehaertl/php-pdftk to do this, but it stopped working when I upgraded to Laravel 6 and I couldn't find out why. It uses PDFtk on the backend. So I'm looking for an alternative way to fill out PDF forms with a data array from my app.

maclet's avatar

On Laravel 8, I used FPDF

composer require codedge/laravel-fpdf

php artisan vendor:publish --provider="Codedge\Fpdf\FpdfServiceProvider" --tag=config

I also had to install FPDM composer require tmw/fpdm

On controller

use Codedge\Fpdf\Fpdf\Fpdf;

use FPDM;

I also needed to save the PDF document in the Pro version of PDFTK ( i bought it for a few bucks)

Under Advanced settings you must put in Advanced Output Options: %PDFTK% %PDFIN% output %PDFOUT%

See screenshot on last post of this page: https://stackoverflow.com/questions/43535455/fpdf-merge-error-number-of-objects-22-differs-with-number-of-xrefs-23-some

Add PDF > Create PDF

Upload the PDF to your site

Then the example on the documentation works

https://github.com/codedge/laravel-fpdf

Please or to participate in this conversation.