This answer How can I determine if a file is a PDF file? recommends to download another library, but my requirement is that I just need to check if a file is directory is of type PDF or not
Using complete library for this use looks like overkill
Well, according to wikipedia PDF files start with magic numbers: "%PDF" (hex 25 50 44 46)
so maybe you should check the InputStream from the file and check that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With