alex62400
alex62400

Reputation: 1

PDFTK on plesk (centos)

I'm trying to use PDFTK on a php page hosted on a PLESK server (Centos) but I have an error...

PDFTK was successfully installed with composer

If I use :

$pdf = new Pdf('form.pdf');
$result = $pdf->fillForm([
    'name'=>'test name',
    'email' => 'test email',
])
->needAppearances()
->saveAs('form_filled.pdf');

I have this error:

sh: pdftk: command not found

I think I found an idea in the documentation : With Plesk (onCentos), I think you need to indicate the full path of pdftk, but I don't know how to find it...

$pdf = new Pdf('/path/my.pdf', [
    'command' => '/some/other/path/to/pdftk',
    // or on most Windows systems:
    // 'command' => 'C:\Program Files (x86)\PDFtk\bin\pdftk.exe',
    'useExec' => true,  // May help on Windows systems if execution fails
]);

Could someone help me or have another idea... Thank you

Upvotes: 0

Views: 187

Answers (1)

chiliNUT
chiliNUT

Reputation: 19573

the php-pdftk composer package doesn't install the pdktk binary for you. You need to install it yourself. From the doc

Requirements

  • The pdftk command must be installed and working on your system

https://github.com/mikehaertl/php-pdftk#requirements

Upvotes: 0

Related Questions