rails, htmldoc and cgi

B

Bober

Hello,
I have some problems with external proces, which is started by rails.

I have found something about generate pdf in rails:

http://wiki.rubyonrails.org/rails/pages/HowtoGeneratePDFs

I would like use htmldoc

but I have a problem with broken pipe.

Code:
add_variables_to_assigns
htmldoc_env = "HTMLDOC_NOCGI=TRUE;export HTMLDOC_NOCGI"
generator = IO.popen("#{htmldoc_env};htmldoc -t pdf --path
\".;http://#{@request.env["HTTP_HOST"]}\" --webpage -", "w+")
generator.puts @template.render("article/pdf")
generator.close_write

send_data(generator.read, :filename => "test.pdf", :type =>
"application/pdf")

When I run it directly from shell everything is ok,
but when I ruby it from method in rails controller,
I see "Broken pipe".

I think, that there is a problem, because rails are cgi process and
htmldoc not. How to improve this?
Can I run htmldoc as cgi process?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top