mileszs/wicked_pdf — Issue #81: `pdf_from_string` does not work on jruby 1.6.5
Author: yuthura
Created: 2012-01-24 08:24:57+00:00
State: open

Within the method definition `pdf_from_string` in wicked_pdf.rb, the block syntax for Open3.popen3 seems to fail on JRuby (at least in 1.6.5 in --1.9 mode); an IO object is returned, instead of the resulting content. Fixed it in a fork by applying the non-block syntax instead, like so:

```ruby
begin
xin, xout, xerr, xwt = Open3.popen3(command_for_stdin_stdout)

xin.write(string)
xin.close

pdf = xout.read
xout.close

err = xerr.read
xerr.close
rescue
# etc...
```

Sorry to say that I won't have the time to write any tests for this for a good while (if ever), but for those using wicked_pdf on JRuby, this might be good to know.

Above also seems to work fine on Ruby 1.9.2-p290 though.