This is Sallazar, all right?!
I’ve used two ways to edit PDF’s.
One of them is editing on the front end itself using the libraries jsPDF and/or html2canvas, both are javascript.
The html2canvas is used to convert all HTML content - which may be stylized - into an image.
The jsPDF is responsible for generating the PDF.
I used both libraries because I had a PNG image resulting from a PDF -> PNG conversion; I defined this image as the background of my body and made all the necessary edits via HTML and CSS. After that, I converted all my HTML content stylized by CSS into an image via html2canvas and then manipulated the result with jsPDF to generate the PDF. Being a PDF generated from an image, the final file was very large (>=5Mb);
The other way is to use the Zendpdf to upload your PDF and make edits with PHP and the library. This way you can create and edit the PDF, keeping the text in text format and the file gains some Kbytes compared to the template.
There are plenty of tutorial on the internet for both ways. I recommend using Zendpdf.
Take a look at XML, maybe this can help you turn this data into an organized form
– riki481