In order to fill a pdf, send two files to /filler, one with fieldname fdffile and one with fieldname pdf-to-fill. The fdffile is a fdf or xfdf file and it will fill the pdf form and the resulting PDF streamed back to the client.
curl -F "fdffile=@file.xfdf" -F "pdf-to-fill=@my.pdf" http://localhost:9021/filler > filledpdf.pdf
<?php
$ch = curl_init("http://localhost:@PORT/filler");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'fdffile' => new \CurlFile(__DIR__.'/fdffile.xfdf','text/plain','file.xfdf'),
'pdf-to-fill' => new \CurlFile(__DIR__.'/pdf-to-fill.pdf','application/pdf','my.pdf')
]);
$result = curl_exec($ch);
file_put_contents("filledpdf.pdf", $result);
This system is using pdftk as the engine to support this function.