How to detect a PDF without an extension?

Can anyone suggest how Hazel might recognise a PDF file whose extension has been lost (and not just hidden)?
When I download PDFs that a server has generated on the fly, they quite often lack a ".pdf" extension. Bank statements are a typical example, but I've just seen the same problem for a product manual from a manufacturer's website. The file is a valid PDF, but my Mac assigns it the creator "TextEdit". Opening it in a text editor shows "%PDF-1.4" (or other version number) at the top of the file. When I add the ".pdf" extension manually, the default app becomes Preview. To repeat, a "Get Info" shows that the extension isn't hidden; it's simply missing.
Getting Hazel to add the extension automatically would be good, but I'm stuck. I can't look for the "%PDF" because both "Contents" and "Text content" appear to be blank when I inspect them within Hazel. And "Kind" is not only not "PDF", it's not even "Document".
For specific bad actors I can match "Source URL/Address" against a list of known URLs. But I'd like a generic solution. Any ideas?
When I download PDFs that a server has generated on the fly, they quite often lack a ".pdf" extension. Bank statements are a typical example, but I've just seen the same problem for a product manual from a manufacturer's website. The file is a valid PDF, but my Mac assigns it the creator "TextEdit". Opening it in a text editor shows "%PDF-1.4" (or other version number) at the top of the file. When I add the ".pdf" extension manually, the default app becomes Preview. To repeat, a "Get Info" shows that the extension isn't hidden; it's simply missing.
Getting Hazel to add the extension automatically would be good, but I'm stuck. I can't look for the "%PDF" because both "Contents" and "Text content" appear to be blank when I inspect them within Hazel. And "Kind" is not only not "PDF", it's not even "Document".
For specific bad actors I can match "Source URL/Address" against a list of known URLs. But I'd like a generic solution. Any ideas?