Ideally I want to avoid using gems, as I am currently using: `pdf-reader`, `combine-pdf` and `origami`

Each gem if it comes across a damaged pdf sometimes doesn't send an exception but stays there and does nothing.

So I would like you to please help me with a code to see if the file is damaged or not.

I have noticed that some pdf files do not have hexadecimal `(hex 25 50 44 46 | %PDF)` but I'm afraid it's not a universal solution.

Besides all those gems sometimes throw exceptions even when the pdf does work, but at least if I'm sure the pdf works, I'll know what to do.

I could start there. How do I read hexadecimal with ruby? Is the only way to check a pdf?