[fxruby-users] Graphics printing with FXRuby?

Stephan Kämper SK at stephankaemper.de
Thu Feb 24 09:31:07 EST 2005


David Peoples wrote:
> Do people who print from their FXRuby programs settle for plain text 
> sent to a port? Do you just not print at all? (I see no mention of 

Ia small app I use

shell = Win32API.new( "shell32", "ShellExecute",
         [ 'L','P','P','P','P','L' ], 'L' )

shell.Call( 0, "print", fname, 0, 0, 0 )

to print plain text. This only works on Windows boxes for obvious 
reasons. BTW, nowadays I'd use DL.

Apparently this (as your workaround) involves creating a temporary file.

> printing in the fxruby-users archives.) I see some mention of it in 
> ruby-talk, but the only solution actually implemented seems to be some 
> variation on "write to a file, launch IE/Mozilla/Word and make it print 
> the file", a solution I'm not thrilled with. 

Neither am I (with the 'solution' given above).

 > Any better ideas? Any code samples?

 From my early programming experience (using Borlands C++Builder) I seem 
to recall that printing under Windows is cumbersome.
But then there are Win apps out there doing a really good job at printing...

My opinion is that printing shouldn't involve additional software like 
ghostscript and what-not. If (and when) I develop a GUI based program, 
in many cases it's something less experienced user use. And these just 
don't understand that printing is (or might) be a problem at all: After 
all any program can issue a print job - OpenOffice, Word, IrfanView...

But I must confess that I couldn't implement this 'feature' either.

Happy rubying


More information about the fxruby-users mailing list