Hi, I''ve been trying to print with FXRuby, and I have to say I was not able to do it, or find a tutorial explaning it. When trying to draw anything inside the dc, my application bombs: ------------------------------- using HP Color LaserJet 4550 PS c:/erp/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.12-mswin32/lib/fox16/itera tors.rb: 344: [BUG] Segmentation fault ruby 1.8.6 (2007-03-13) [i386-mswin32] ------------------------------- I''ve bee trying different mixes of beginPrint / beginPage, and the last thing I''ve been trying is: ------------------------------- print_dialog = FXPrintDialog.new(self, "Print Something") if print_dialog.execute != 0 print_instance = FXDCPrint.new($app) print_instance.beginPrint(print_dialog.printer) do |dc| print_instance.beginPage(1) do |dc| dc.drawImage(@image, 0, 0) end end end ------------------------------- I came accross an old post of year 2002 saying FXDCPrint was not working yet. Is it still the case maybe? Most likely, I''m doing something wrong... Can anyone help? Thanks, Philippe
fxruby-users-bounces at rubyforge.org wrote:> Hi, > > I''ve been trying to print with FXRuby, and I have to say I was not > able to do it, or find a tutorial explaning it. > > When trying to draw anything inside the dc, my application bombs: > > ------------------------------- > using HP Color LaserJet 4550 PS >c:/erp/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.12-mswin32/lib/fox16/itera> tors.rb: > 344: [BUG] Segmentation fault > ruby 1.8.6 (2007-03-13) [i386-mswin32] > ------------------------------- > > I''ve bee trying different mixes of beginPrint / beginPage, and the > last thing I''ve been trying is: > > ------------------------------- > print_dialog = FXPrintDialog.new(self, "Print Something") if > print_dialog.execute != 0 print_instance = FXDCPrint.new($app) > print_instance.beginPrint(print_dialog.printer) do |dc| > print_instance.beginPage(1) do |dc| > dc.drawImage(@image, 0, 0) > end > end > end > ------------------------------- > > I came accross an old post of year 2002 saying FXDCPrint was not > working yet. Is it still the case maybe? Most likely, I''m doing > something wrong... Can anyone help?Hi again. A few more precisions: This code works when printing into a Postscript file, but does a GPF when trying to print on a real printer, even a Postcript one: ------------------------------- print_dialog = FXPrintDialog.new(self, "Print Something") if print_dialog.execute != 0 print_instance = FXDCPrint.new($app) print_instance.setContentRange(0, 0, 1280, 1024) print_instance.beginPrint(print_dialog.printer) do |dc| print_instance.beginPage(1) do |dc| dc.foreground = FXRGB(255, 150, 185) dc.drawLine(0, 0, 400, 0) dc.drawLine(0, 0, 0, 400) end end end ------------------------------- Second thing: there seems to be a problem with drawImage, associated with an FXDCPrint. (There is not problem when associated with an FXDCWindow). The following code does not reveal any image data in the Postcript file, and does a GPF when trying to print on a real printer. ------------------------------- print_dialog = FXPrintDialog.new(self, "Print Something") if print_dialog.execute != 0 print_instance = FXDCPrint.new($app) print_instance.setContentRange(0, 0, 1280, 1024) print_instance.beginPrint(print_dialog.printer) do |dc| print_instance.beginPage(1) do |dc| dc.drawImage(@image, 0, 400) end end end ------------------------------- Philippe Lang
On Mar 7, 2008, at 3:09 AM, Philippe Lang wrote:> I came accross an old post of year 2002 saying FXDCPrint was not > working > yet. Is it still the case maybe? Most likely, I''m doing something > wrong... Can anyone help?Philippe, I''ll look into this this weekend, but I seriously doubt Jeroen has done anything else with the FXDCPrint functionality since that time. It was always a half-baked feature that really only worked for generating postscript documents, IIRC. Since FXRuby is just a layer on top of FOX, if it''s broken in FOX, it''s broken in FXRuby. Lyle --- "FXRuby: Create Lean and Mean GUIs with Ruby" Now available as a Beta book from the Pragmatic Bookshelf http://www.pragprog.com/titles/fxruby
fxruby-users-bounces at rubyforge.org wrote:> On Mar 7, 2008, at 3:09 AM, Philippe Lang wrote: > >> I came accross an old post of year 2002 saying FXDCPrint was not >> working yet. Is it still the case maybe? Most likely, I''m doing >> something wrong... Can anyone help? > > Philippe, > > I''ll look into this this weekend, but I seriously doubt Jeroen has > done anything else with the FXDCPrint functionality since that time. > It was always a half-baked feature that really only worked for > generating postscript documents, IIRC. Since FXRuby is just a layer > on top of FOX, if it''s broken in FOX, it''s broken in FXRuby.Hi, Is there a Windows-only utility/workaround that allows building an FXRuby Windows application that is able to print directly on a printer? FXDCPrint seems to be useless... Regards, Philippe