The PDF family reads the header of a PDF file. It finds the header and its
version. The MIME type of PDF files is application/pdf.
The PDF specification lets the %PDF-M.m header start anywhere in the first
1024 bytes of a file. Both functions search that range.
isPdf
Returns true when data starts with a PDF file header.
Node.js
Python
detectVersion
Reads the version, for example "1.7", from the PDF header of data. Returns
null in Node.js and None in Python when the first 1024 bytes of data do
not contain a PDF header.