Forum OpenACS Q&A: Response to Help for using HTMLDOC to output pdf file/download pdf file

From the output you posted it looks like ns_returnfile correctly does return the pdf as desired, but something else outputs the string "Error PAGES: 1 BYTES: 3612 mailto:webmaster@localhost.localdomain"; to the connection before that, which screws up the headers, which obviously confuses the browser.

It propably has to do something with the exec call. I'd first try to comment the exec out, put a pregenerated pdf in /tmp/ and see if you can return that with ns_returnfile. If that works then try to redirect stderr and stdout of the exec to /dev/null ("man 3tcl exec" tells you how).