You will need to parse the PDF - theoretically you can write your own parsing functions. However, you would save a lot of time using something ready-made.
What about Apache PDFBox ? You can execute it like any other shell script, or use the PHP / Java bridge .
If you decide to go manually, see the PDF specification for implementing your parser - you should simply ignore any complex parts and catch the signature by looking for startxref.
There are also proprietary solutions such as VersyPDF.PHP , but this may be a little redundant for your work (but on the plus side, you can get away with using the evaluation version as you don't care about the watermarked edition).
source share