Dimas Cyriaco wrote:
> I'm using windows.
> I manage to get the printer`s name using wxruby's PrintDialog, and tried
> to redirect $stdout to it, but it doesn't work...
So how did you attempt to redirect $stdout to it? From within Ruby?
(Show the code) From a batch file which runs your Ruby script? (Show the
code)
> In fact i'm trying to print a report made using Ruport.
It's a long time since I fought with Ruport and its awful API, but I did
document what I found out on the Wiki. Here it is:
http://stonecode.svnrepository.com/ruport/trac.cgi/wiki/DimwitsGuideIf Ruport currently returns the report to you as a string, then just:
report = .... do something with Ruport ...
File.open("out.txt","w") { |f| f.write(report) }
But it should be possible to tell it to write directly to a file, by
passing :io as an option to the relevant rendering call. Something like
this:
ro = { .. rendering options .. }
fmt = :html
File.open("out.txt", "w") { |f| report.as(fmt, {:io=>f}.merge(ro)) }
HTH,
Brian.
--
Posted via
http://www.ruby-forum.com/.