-
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
- Are there any ways to know that a Java File is of type PDF?
This answer How can I determine if a file is a PDF file? recommends
Share
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.