in reply to
Anyone have an example that checks the integrity of a pdf file?
If by validate you do not mean check for tampering, but mean does this pdf look like it will parse correctly the short answer is no. A longer answer is that there are many PDF engines out there:
9 or 10 variants of adobe engines in product or oem libraries
open source engines such as libpdf, ghost etc
other 3rd party closed source engines.
Each of these variants parse and handle pdfs in slightly different ways (some very strict, some loose) -- the only way to actually verify PDF will parse is to apply the engine you are concerned about. Even if parseable without any errors or warnings -- nothing can be said for the visual output matching what is expected.