If the pdf content still displays as text, you may be outputting data before the header function sets the content type. This happened on a project where the passthru function was being used, and other class files were required. One of the class files had an extra line after the last php tag, so that blank line was output and the browser sent a header for text/html.