# Print problem with Mac OS X cutting pages

**URL:** <https://www.ruby-forum.com/t/print-problem-with-mac-os-x-cutting-pages/176374>\
**Category:** wxRuby\
**Created:** [September 29, 2009, 8:00pm UTC](https://www.ruby-forum.com/t/print-problem-with-mac-os-x-cutting-pages/176374 "2009-09-29T20:00:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arno\_Dirlam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Arno\_Dirlam](https://www.ruby-forum.com/u/Arno_Dirlam)\
**Post date:** [September 29, 2009, 8:00pm UTC](https://www.ruby-forum.com/t/print-problem-with-mac-os-x-cutting-pages/176374/1 "2009-09-29T20:00:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Arno\_Dirlam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Arno\_Dirlam](https://www.ruby-forum.com/u/Arno_Dirlam)\
**Post date:** [September 30, 2009, 12:56pm UTC](https://www.ruby-forum.com/t/print-problem-with-mac-os-x-cutting-pages/176374/2 "2009-09-30T12:56:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Arno\_Dirlam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Arno\_Dirlam](https://www.ruby-forum.com/u/Arno_Dirlam)\
**Post date:** [October 6, 2009, 11:47pm UTC](https://www.ruby-forum.com/t/print-problem-with-mac-os-x-cutting-pages/176374/3 "2009-10-06T23:47:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Arno\_Dirlam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Arno\_Dirlam](https://www.ruby-forum.com/u/Arno_Dirlam)\
**Post date:** [October 7, 2009, 12:10am UTC](https://www.ruby-forum.com/t/print-problem-with-mac-os-x-cutting-pages/176374/4 "2009-10-07T00:10:27Z")

</div>

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.
