More... apparently not-so-simple printing issues
More... apparently not-so-simple printing issues
- Subject: More... apparently not-so-simple printing issues
- From: Andrew Kinnie <email@hidden>
- Date: Wed, 30 Jun 2004 12:24:32 -0400
I have still not been able to sort out the receipt printer issues. I
have a Star TSP 613 printer, which prints using a sample they created
in OS X using Carbon, (but which prints out their sample receipt). I
realize I could try and use Carbon with Cocoa, but I feel as a Cocoa
guy, I should use cocoa's methods. However, I can't get the thing to
print out a string of text in a legible fashion using cocoa.
Reading the Apple docs, apparently, I need to create an
NSPrintOperation, with a printInfo, and a view and then tell the
operation to run. Seems simple enough, but as I simply want to print
our a sting of text, and I don't need to have it appear on the UI, it
seems strange. Nonetheless, I tried, but unfortunately, the text is
extremely small and indented. I therefore set the font, and margins,
and it's still extremely small.
I don't know what else to do.
The thing prints, but it is so small, it is illegible. Star, the
printer manufacturer, says they can't help me with Cocoa.
This is quite frustrating.
For your edification (whatever that means), this is the complete method
as I have it so far. All I want to do it dump a string of text to a
printer which prints fixed width fonts best up to a width of 72mm:
- (void)printReceipt:(Transaction *)transToPrint
{
NSPrintOperation *op;
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
NSFont *font = [NSFont userFixedPitchFontOfSize:10.0];
[printInfo setLeftMargin:0.0];
[printInfo setRightMargin:0.0];
[printInfo setBottomMargin:0.25];
NSTextView *view = [[NSTextView alloc] initWithFrame:[printInfo
imageablePageBounds]];
[view setFont:font];
[view insertText:[transToPrint descriptionSummary]];
op = [NSPrintOperation printOperationWithView:view];
[op setShowPanels:NO];
[op runOperation];
[view release];
[printInfo release];
}
If anyone has any suggestions, I'd be happy to hear them.
Andrew
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.