Determine if a byte[] is a pdf file September 5, 2023 by Tarik Check the first 4 bytes of the array. If those are 0x25 0x50 0x44 0x46 then it’s most probably a PDF file.