Possible Duplicate:
Detect if PDF file is correct (header PDF)
I want to validate that the data in a FileStream instance represents a valid PDF document. Specifically, I need to know that Adobe Reader will be able to successfully open the file.
Can anyone recommend an open source library or best practice for this task?
Take a look at iTextSharp , it should give you what you need.
EDIT:
I know it’s bad practice to use exceptions to control flow, but you could do this: