Look for the PDF magic number by opening the file and reading the first few bytes of data. Most files have a specific format, and PDF files start with %PDF.
You can check the first 5 characters of the file, if they equal "%PDF-", it is likely a real PDF (however, this does not definitively prove that it is a PDF file, as any file can begin with those 5 characters). The next 4 characters in a proper PDF file contain the version number (i.e. 1.2).