D
Dimas Cyriaco
Still trying to print stuff...
someone knows how to redirect $stdout to a printer??
Thanks!
someone knows how to redirect $stdout to a printer??
Thanks!
Have been researching this, and not coming up with much. However, I'mDimas said:Still trying to print stuff...
someone knows how to redirect $stdout to a printer??
Thanks!
Have been researching this, and not coming up with much. However,
I'm getting a strong sense that we need to know your OS.
Here's a path which may solve a lot of problems for you - Ruby Ruports -Dimas said:Still trying to print stuff...
someone knows how to redirect $stdout to a printer??
Thanks!
Tom said:Have been researching this, and not coming up with much. However, I'm
getting a strong sense that we need to know your OS.
t.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< (e-mail address removed) >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anyone?
Dimas said: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...
In fact i'm trying to print a report made using Ruport.
(1) File.open("prn:","w") { |f| ... }
(2) IO.popen("print","w") { |f| ... }
Hi,
Am Dienstag, 07. Jul 2009, 20:10:53 +0900 schrieb Brian Candler:
The original question was how to redirect $stdout.
def print_it
IO.popen "lpr -o some_option", "w" do |f|
$stdout = f
yield
end
ensure
$stdout = STDOUT
end
Sorry, I can only test and will only provide the UNIX version.
Bertram
know the device name of the printer?
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)
The original question was how to redirect $stdout.
def print_it
IO.popen "lpr -o some_option", "w" do |f|
$stdout = f
yield
end
ensure
$stdout = STDOUT
end
require 'win32ole'
SHELL_APP = WIN32OLE.new('Shell.Application')
SHELL_APP.ShellExecute("test.pdf", '', "C:\\Temp", 'print', 0)
otherwise you can try printing to a shared network printer:
PRINTER = "\\\\192.168.1.1\\shared_printer"
system "print /d:#{PRINTER} C:\\Temp\\test.txt"
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.