I’m using htmldoc-0.2.3 on ruby 1.8.7 and I’m struggling to get it
working. I’ve created the following ruby file and get the following
error:
require ‘rubygems’
require ‘htmldoc’
pdf = PDF::HTMLDoc.new
pdf.set_option :outfile, “/tmp/outfile.pdf”
pdf << ‘test text’
if pdf.generate
puts “Successfully generated a PDF file”
else
puts pdf.result[:output]
end
Error:
/Users/dandan/.rvm/gems/ruby-1.8.7-p302/gems/htmldoc-0.2.3/lib/
htmldoc.rb:182:in execute': Invalid program path: htmldoc (PDF::HTMLDocException) from /Users/dandan/.rvm/gems/ruby-1.8.7-p302/gems/htmldoc-0.2.3/lib/ htmldoc.rb:154:ingenerate’
from pdf.rb:17
To attempt to fix this I added
PDF::HTMLDoc.program_path = ‘/Users/dandan/.rvm/gems/ruby-1.8.7-p302/
gems/htmldoc-0.2.3’
Running the script again I get the output from pdf.result[:output]:
sh: /Users/dandan/.rvm/gems/ruby-1.8.7-p302/gems/htmldoc-0.2.3: is a
directory
Has anyone else experienced this problem and has a solution. I’m
guessing I’m giving the wrong program path but I’m not sure which path
I should be giving.
I’m using htmldoc-0.2.3 on ruby 1.8.7 and I’m struggling to get it
working. I’ve created the following ruby file and get the following
error:
require ‘rubygems’
require ‘htmldoc’
pdf = PDF::HTMLDoc.new
pdf.set_option :outfile, “/tmp/outfile.pdf”
pdf << ‘test text’
if pdf.generate
puts “Successfully generated a PDF file”
else
puts pdf.result[:output]
end
Error:
/Users/dandan/.rvm/gems/ruby-1.8.7-p302/gems/htmldoc-0.2.3/lib/
htmldoc.rb:182:in execute': Invalid program path: htmldoc (PDF::HTMLDocException) from /Users/dandan/.rvm/gems/ruby-1.8.7-p302/gems/htmldoc-0.2.3/lib/ htmldoc.rb:154:ingenerate’
from pdf.rb:17
To attempt to fix this I added
PDF::HTMLDoc.program_path = ‘/Users/dandan/.rvm/gems/ruby-1.8.7-p302/
gems/htmldoc-0.2.3’
Running the script again I get the output from pdf.result[:output]:
sh: /Users/dandan/.rvm/gems/ruby-1.8.7-p302/gems/htmldoc-0.2.3: is a
directory
Has anyone else experienced this problem and has a solution. I’m
guessing I’m giving the wrong program path but I’m not sure which path
I should be giving.
Thanks abundantly for any help!
Dan
Dan,
Step on is to confirm that you have the htmldoc executable installed. which htmldoc should return the location of the binary. The gem only
wraps calls to the executable, so doing point it back to itself.
If you have htmldoc installed, then check path issues.
Ken
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.