ouput buffering confusing me!

the_content(), output of which you are filtering, is a template tag. It’s meant to be used as part of HTML page. One page load cannot simultaneously be HTML page and PDF download.

File download you are generating needs to happen before HTML template is loaded, for example on template_redirect hook and exit after so that execution doesn’t process to output HTML (or it would get stuffed inside your PDF file, likely breaking it).