From: Hongyi Zhao on
On Tue, 16 Feb 2010 07:27:48 -0800 (PST), Fred
<fred.l.kleinschmidt(a)boeing.com> wrote:

>Note that just because the first line of a file begins with "%PDF-"
>it does not guarantee that the rest of the file is actually in PDF
>format.
>So the test can only determine that a file is either *not* PDF, or
>that the file is "might be PDF".

Not so, the pdfinfo will do some more checks besides that magic code.

See the following test:

$ echo %PDF- > 11
$ pdfinfo 11
Error: PDF version 
-- xpdf supports versio
n 1.7 (continuing anyway)
Error: PDF file is damaged - attempting to reconstruct xref table...
Error: Couldn't find trailer dictionary
Error: Couldn't read xref table
--
..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.