Hi,
I am using the wxruby printing framework to print cash receipts with a
small
thermo-printer, which can naturally produce very long pages if a lot of
articles are printed on them.
Under Windows XP there are no problems, but under Mac OS X text is not
printed if it’s below a certain line on the printed page (i.e. the “top”
parameter is too large).
I have found out, however, that when I calculate the size of it, it is
exactly where a A4 page would end (just with different scaling), i.e.
after
about 150% of the width of the page.
I have already tried several other page formats, e.g. letter format
(because
the longer side there is more than 150% of the shorter side), but
without
success.
Has anyone else experienced this problem? Can this be fixed from within
wxruby?
Please fix it! This feature is really important to me!
Thanks a lot,
Don
Hi
Arno Dirlam wrote:
after about 150% of the width of the page.
I’m not very familiar with the printing framework, so it would help to
see a short excerpt of the most relevant pieces of code just to know
what classes you’re using.
More generally if there is a way to solve this (I expect there is) it
will be general to wxWidgets and wxPython. So you might want to try
searching for help but using the classnames with wx prefix (eg
wxPrintout). I’ve often found answers to obscure questions via wxPython,
simply because that framework has been around a lot longer. Also if it’s
a bug, it will have to be fixed in wxWidgets and won’t be fixable in
wxRuby alone.
alex
Hi,
the code basically looks like this (whereas the &block variable tells
the
MyPrintout what to print):
print_data = Wx::PrintData.new
print_dialog_data = Wx::PrintDialogData.new(print_data)
print_dialog_data.set_all_pages true
print_dialog_data.set_to_page 1
printer = Wx::Printer.new(print_dialog_data)
parent = Wx::Frame.new(nil, -1, “wxRuby Printing”, Wx::Point.new(0, 0),
Wx::Size.new(400, 400))
print_data.set_printer_name(new_printer_name) # set printer
print_dialog_data.set_print_data(print_data)
printer = Wx::Printer.new(print_dialog_data)
printout = MyPrintout.new(options.delete(:title) || “My printout”,
print_data, options, &block)
print it
if (!printer.print(parent, printout, false))
if (Wx::Printer.get_last_error == Wx::PRINTER_ERROR)
raise ArgumentError, “There was a problem printing.\nPerhaps your
current printer is not set correctly?”
else
raise ArgumentError, “You canceled printing”
end
end
Most of it is taken from the Printing example shipped with wxRuby. It is
modified, however, to work without user interaction.
What is your guess?
Thanks and best regards,
Don
I believe in this case, wxRuby is using the Default Font provided by the
OS,
either that be Windows, or Mac OS X. I do believe there needs to be
some
calculation to set the constraints with reference to the Font used, so
you
may need to do some Device Caps calculations on Fonts, against a DC
grabbed
from the Printer. Don’t ask me how to go about that, as I’ve never
dealt
with the wxRuby printer framework, in any way shape or form, just
remembering some things from Device Caps and DC drawing / printing on
various other platforms.
hth,
Mario S.