Printing (on Windows) without using any print dialogs

I am developing a Windows application that is going to print on
envelopes (C5 and C6 envelopes) based on data, that is retrieved from an
external order system.

The application is going to be running mostly automatic. So I need to
bypass the print setup dialog, that is normally used when printing with
wxRuby.

This presents me with some problems. I create a Wx::PrintData object to
control the printer, paper size, orientation, etc. like this (the
printer name is just an example, I hold it in a config file):

pd = Wx::PrintData.new
pd.set_printer_name(“Dell 3110cn”)
pd.set_paper_id(Wx::PAPER_ENV_C6)

The last line gives me this error:

`set_paper_id’: Expected argument 1 of type wxPaperSize, but got Fixnum
31 (TypeError)

The type wxPaperSize is not defined (as far as I can see), but it iś
something coming from the SWIG interface. I don’t really know how to
solve this.

If outputting the existing paper_id I get:

puts pd.get_paper_id.inspect

#SWIG::TYPE_p_wxPaperSize:0x2173c40

Which doesn’t really make it any clearer for me. So how should I do
this?

/ Carsten

Hi Carsten

On 17/04/12 12:33, Carsten G. wrote:

`set_paper_id’: Expected argument 1 of type wxPaperSize, but got Fixnum
31 (TypeError)

The type wxPaperSize is not defined (as far as I can see), but it iś
something coming from the SWIG interface. I don’t really know how to
solve this.

It looks like wxRuby doesn’t know at the moment that PaperSize is just a
constant and it should treat it as such. It’s an oversight in the
wrapping, sorry.

#SWIG::TYPE_p_wxPaperSize:0x2173c40

Which doesn’t really make it any clearer for me. So how should I do
this?

It’s not something that can be worked round directly in Ruby, I think.
The best thing to do would be to post a bug - it isn’t a difficult fix
to the C wrapper, but I don’t have time now I’m afraid.

alex