Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Printing NSView - margins issue

maskedrmaskedr TimisoaraPosts: 44Registered Users @
I'm developing a mac app for a client which has the print functionality. I'm using NSView for printing. The code I used:


// Contructing the view
self.printProductViewController = [[PrintProductViewController alloc] initWithParent:self withSelector:@printProductViewResponse withExtraInfo:valuesToBePassed];
[self.view addSubview:self.printProductViewController.view];
[self.printProductViewController.view removeFromSuperview];

NSPrintOperation *op;
op = [NSPrintOperation printOperationWithView:self.printProductViewController.view];
NSPrintInfo *pi = [op printInfo];
// Force page to fit one page
[pi setHorizontalPagination:NSFitPagination];
[pi setVerticalPagination:NSFitPagination];

// Setting the page orientation
[pi setOrientation:NSPaperOrientationLandscape];

// Setting the margins
[pi setBottomMargin:0];
[pi setLeftMargin:0];
[pi setTopMargin:0];
[pi setRightMargin:0];

// Set the image to center horizontal and vertical
[pi setVerticallyCentered:YES];
[pi setHorizontallyCentered:YES];

[op runOperation];


The problem is how the printer print the information on the paper. Even if I set the margins to 0 the printer still set some left and right margins. I've spoke with a friend who is a C# developer and he told me the printer have some extra margins called hard margins.

So the question is how to get rid off all the margins?

Thx in advance!
Sign In or Register to comment.