How does -drawPageBorderWithSize: place pageHeader?
How does -drawPageBorderWithSize: place pageHeader?
- Subject: How does -drawPageBorderWithSize: place pageHeader?
- From: Mike Wright <email@hidden>
- Date: Wed, 12 Mar 2008 17:47:18 -0400
I have an app (Universal, compiled using XCode 2.5, running on an
Intel iMac, under Leopard) that lets the user set page margins when
printing. It also lets them specify the printing of headers and footers.
The odd thing I'm seeing with this is that the placement of the
pageHeader string varies with the frame of the NSTextView subclass
that I'm printing.
When the view frame's origin.y is set to the default value of 72, the
left end of the pageHeader is about a quarter-inch in, and the entire
header string has about a quarter-inch of space above it. That works
fine with my printer.
As origin.y is reduced, the page header not only moves up--it also
expands the the left and right. With a topMargin of 14.4, the header
string has only about a sixteenth-inch of space to the left, to the
right, and above it. This moves it into the non-printable margins of
the paper.
I implemented -drawPageBorderWithSize:borderSize in my printing view
(just calling super), and borderSize is always the paper size,
regardless of any changes in the view's frame due to the margin
settings.
This width change looks like a bug to me, as does the vertical
position change. I can see no motivation for them, since all the
changes do is to push the header out of the printable area of the
paper. I've searched the documentation, but I don't see anything about
how the default method determines where to place the header.
(I tried explicitly reducing borderSize in -
drawPageBorderWithSize:borderSize, but the result is that the header
string still prints at the same left position--but with the overall
width of the string reduced, so that the date is moved to the right by
the amount that borderSize was reduced.)
Unless someone can explain why it's not a bug, I guess I'll report it.
And, even if it is, should I go ahead and try writing my own -
drawPageBorderWithSize:borderSize--assuming that there won't be a
quick fix--or even any fix at all for Tiger?
I'm not sure how to approach that, since NSPrinter's -
imageRectForPaper:paperName is deprecated, with no replacement that I
can see. Is there some other way to find out where I should NOT place
the header and footer?
As it is, the default footer shows up in Preview, but is down in the
middle of the bottom margin for my printer, so it doesn't actually
print. I assume that this is because the built-in -
drawPageBorderWithSize:borderSize also has no way of determining the
printable area of a page. (I found a post asking about this from 3 Nov
2005, but no replies.)
Thanks,
Mike Wright
http://www.idata3.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden