Re: Printing Appears Very Small in Lower-Left Corner of Page
Re: Printing Appears Very Small in Lower-Left Corner of Page
- Subject: Re: Printing Appears Very Small in Lower-Left Corner of Page
- From: Gerry Beggs <email@hidden>
- Date: Tue, 18 Jan 2011 19:42:35 -0600
Just to follow-up (and clarify) my own problem:
I have implemented NSDocument's printOperationWithSettings: method to kick off the printing process when the user selects Print from the File menu.
I am using the same NSView drawRect: method to display on-screen as when printing.
The Print Preview in the Print Dialog always appears correct.
However, the final print output is appearing scaled down, either when printing to paper, or to PDF.
When the problem presents itself, the transformation of the CGContext is the same when drawing the print preview as when drawing the actual output. That is, it is scaled down, which explains why the output is small.
When the problem doesn't present itself, the transformation is the identity transformation when drawing the actual output.
I've discovered that if I run my application as a 64-bit executable, the problem goes away.
When running under 32-bit, the problem is consistent.
Thanks for any help.
On 2011-01-16, at 1:24 AM, Gerry Beggs wrote:
> I've been having a problem with my application sometimes (but not always) printing the full page, but it appears VERY small in the lower-left corner of the page.
>
> I was having trouble reproducing it, but finally received a sample document from one of my users that let me reproduce it.
> Still, sometimes it prints correctly filling the page, other times, it prints scaled down in the lower-left corner of the page.
>
> I am using NSPrintOperation from an NSDocument to handle the printing operations.
>
> When trying to debug this issue, I examined the transformation from my view's drawRect method using CGContextGetCTM.
> I discovered something interesting:
> - When the printout appears scaled down, the transformation structure is the same as it is when the print preview image is rendered.
> - When the printout appears full-sized, the transformation structure is the identity matrix (ie. scale = 100%)
>
>
> Since the scale of the CGContext is the same when rendering the print preview as it is when rendering the full-sized page, this explains why my printouts are appearing very small in my output.
>
> Values 'a' and 'd' in the CGAffineTransformation structure indicate the scaling factor and for the print preview, it makes sense that it is scaled down for the print preview. But somehow, the transformation is not being set back to 100% scaling for the actual printing.
>
> I've looked for unbalanced CGContextSaveGState/CGContextRestoreGState calls, but they are all balanced.
>
> I've spent too much time trying to debug this. If anyone can give any ideas why my printouts are appearing scaled down, I would appreciate any help.
> Thanks.
>
> --
> email@hidden http://www.GerrysCuppaTea.org/
>
> _______________________________________________
>
> 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
>
--
email@hidden http://www.GerrysCuppaTea.org/
_______________________________________________
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