Skip navigation.
 
mlRe: Rotating an NSView before printing
FROM : Buddy Kurz
DATE : Sat Apr 28 19:14:20 2007

I wrote a printer emulation view that needed to rotate itself for 
landscape printing.
In the init method, I create and retain a NSAffineTransform to handle 
he rotation
       toLandscape = [[NSAffineTransform transform] retain];
       //we move down and then rotate
       [toLandscape translateXBy:0 yBy:[self frame].size.height];
       [toLandscape rotateByDegrees:-90];

In the drawRect: method, I apply the transform if needed
   //each new page needs to have transformation applied
   if (isLandscape) {
       [toLandscape concat];
   }
   //draw stuff

On Apr 28, 2007, at 6:16 AM, James Williams wrote:

> ...
> I've spent the last two weeks fighting with this and I've almost 
> got it
> working, but I'm missing something. I also think I might be making 
> it too
> hard so any advice that you have would be really appreciated!
>
> I've simplified my code to just draw a border around the entire 
> envelope. I
> think that if I get that working, all of my other code will work as 
> well.
> Right now, it prints inverted (correct), but the border for my view 
> is a few
> points off of the edge of the page so the entire thing is unable to 
> fit on
> the physical envelope (it bleeds off the edge of the right side but 
> is all
> white space on the left side).
>
> I hope I haven't included too much introduction or code, but I'm 
> not sure
> which of my functions is the problem (maybe all of them are).
>
> Thanks in advance!
>
> --James
> ...

Related mailsAuthorDate
mlRotating an NSView before printing James Williams Apr 28, 15:16
mlRe: Rotating an NSView before printing Matt Neuburg Apr 28, 18:27
mlRe: Rotating an NSView before printing Buddy Kurz Apr 28, 19:14