Close PDF form after filling with pdftk php

359 views Asked by At

I am using php-pdftk with laravel nova, filling a form after saving a resource. The problem is that the generated filled pdf is still editable.

Is there any way to close that PDF after filling it?

I've read that setting "flatten" property can do that, but it is incompatible with needAppearances(), which is needed for spanish characters

    $pdf = new Pdf( storage_path() . '/app/contracts/' . $this->contract_type . '.pdf', [
        'command' => 'pdftk',
        'useExec' => true
    ]);
    $pdf->fillForm($pdf_content)
        ->needAppearances();

Thanks!

1

There are 1 answers

0
lopandpe On

Finally, the only issue was that those form fields had, in the pdf, a font that don't have those characters.

Changing that font solved the problem. By default, Acrobat set a very basic font for custom forms...