How can I store a pdf in PostgreSQL
First, I store PDF's in the db as bytea's.  They are easier to manage than large objects and you really dont get very much out of the streaming API (now, streaming video, that should go into lobs).  The one real problem with doing this is that it takes extra memory to unescape the data when it comes back to the database and you really can't stream it effectively.

The key thing is that you have to unescape the data when it comes back.  libpq provides functions for that as do other programming languages.  A few (like Perl) provide db drivers which automatically handle these cases.

You are on to the right structure here.  Store it as a bytea and unescape it on retrieval.