0

I know using the following code, we can check if the file is a PDF or Not.Is there a way in PHP to check if the PDF is a fillable PDF or a Normal PDF.

$finfo = finfo_open(FILEINFO_MIME_TYPE);
foreach (glob("path/to/files") as $filename) {
    if(finfo_file($finfo, $filename) === 'application/pdf') {
        echo "'{$filename}' is a PDF" . PHP_EOL;
    } else {
        echo "'{$filename}' is not a PDF" . PHP_EOL;
    }
}
finfo_close($finfo);

enter image description here

user580950
  • 3,558
  • 12
  • 49
  • 94
  • What have you tried? What errors did you get? If no errors displayed please post your PHP error Log. Thank you – Mark Twigg Aug 17 '16 at 14:31
  • @MarkTwigg I searched on Google and do not find anything related to my question, that's why I am here to see if it is really possible. – user580950 Aug 17 '16 at 14:34
  • 1
    Perhaps you're looking for http://stackoverflow.com/questions/4493189/reading-pdf-metadata-in-php, If you aren't using Zend, the answer with PDF Parser should work for you. – TheGentleman Aug 17 '16 at 14:51
  • @GentlemanMax thanks for the URL, I already checked PDFparsed demo, the metadata does not return anything related to the fillable pdf, please check http://prntscr.com/c6w9r8 – user580950 Aug 17 '16 at 15:04
  • Maybe https://www.setasign.com/products/fpdi/about? – TheGentleman Aug 17 '16 at 15:11
  • @user580950 I am also looking for the exact solution. Can you please tell me the solution for it if you find out? – Adarsh Tiwari May 02 '17 at 19:37

0 Answers0