Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to print an NSImage

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 1.32k
    Comment on it

    The following code prints an image stored in a file:

    -(void)print:(id)sender
    {
        NSImage *image = [[NSImage alloc]initWithContentsOfFile:[imageEdWindowController getImageLocation]];
        [image scalesWhenResized];
        NSImageView *_imageView = [[NSImageView alloc]init];
        [_imageView setFrame:NSMakeRect(0, 0,[image size].width, [image size].height)];
        [_imageView setImage:image];
        NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
        [printInfo setHorizontalPagination: NSFitPagination];
        [printInfo setVerticalPagination: NSFitPagination];
        [[NSPrintOperation
          printOperationWithView:_imageView printInfo:printInfo]
         runOperation];
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: