Adobe deserve a pile of the blame here for the pdf spec - it only requires the magic to appear in the first 1024 bytes[1] (and that %EOF appears in the last 1024) - thus allowing silly tricks like PDFs that are also another file type [2].
[1] http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdf... section 3.4.1