I was searching about 3 hours to find a solution to my problem. I already browsed trough the stackoverflow questions regarding my problem but could not find a solution.
What I'm currently trying to do is to replace text in a PDF form field using PHP. The PDF file has a textfield containing a placeholder text like [placeholder].
What I tried to do is:
$pdf_content = file_get_contents(source_pdf.pdf);
$put = str_replace('[placeholder]', 'NEW VALUE', $pdf_content);
file_put_contents('temp_pdf/test.pdf', $put);
When I open the PDF it seems that the placeholder was not replaced. But if I klick into the textfield my "NEW VALUE" appears. If I klick out again "[placeholder]" is assigned again.
Due to this I think this is not the right attempt for my purpose.
My question now is: Is there a simple and effective way to implement this? I don't want to use FDFs but instead replace the text right in my source PDF.