jeudi 27 avril 2017

Fill PDF form with PHP

Today i found a repo called pdftk that was made by Mike Haert, i installed it with composer, now when i want to fill the forms the script returns a error with: sh: 1: pdftk: not found , pdftk is installed and i can use it in the CLI, i tried to convert manually the pdf file to a fdf file with the following code: pdftk original.pdf generate_fdf output generated.fdf but i still get this error, is there a alternative for the repo of mikehaert? Or someone that already made this in Laravel? My code:

<?php
    use mikehaertl\pdftk\Pdf;
    $storage_path = storage_path();

    $pdf = new Pdf($storage_path.'/alkenbon.fdf');


    $pdf->fillForm(array(
        'pdf-date'=>'sdfsdf',
        'pdf-store' => 'valX',
        'pdf-price' => 'valY',

    ))
        ->needAppearances()
        ->saveAs('filled.pdf');

    $pdf = new Pdf('form.pdf');
    $pdf->fillForm('data.xfdf')
        ->saveAs('filled.pdf');

    if (!$pdf->saveAs('my.pdf')) {
        $pdf->getError();
    }

    dd($pdf);
}
?>



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2qiTmXl
via IFTTT

Aucun commentaire:

Enregistrer un commentaire