Set text equal to string and pass to receipt printer at a different size on iOS
Posted
by
Max Roper
on Stack Overflow
See other posts from Stack Overflow
or by Max Roper
Published on 2012-03-27T23:27:40Z
Indexed on
2012/03/27
23:28 UTC
Read the original article
Hit count: 201
I am using the StarIO SDK to print text to a receipt printer and I am trying to get a certain line of text larger than the rest. I have some help from their support but I can't really get it to go.
-(void)print{
NSMutableString *final=[NSMutableString stringWithFormat:@"-----"];
[final appendFormat:@"\n\nLevel:%@ Section:%@ Row:%@ Seat:%@", [response_dict objectForKey:@"level"], [response_dict objectForKey:@"section"],[response_dict objectForKey:@"row"],[response_dict objectForKey:@"seat"]];
There is a bunch of other stuff that is printing, but that is the line that I would like to be a different size than the rest. The StarIO support said that I should try and pass that to this...
-(IBAction)PrintText
{
NSString *portName = [IOS_SDKViewController getPortName];
NSString *portSettings = [IOS_SDKViewController getPortSettings];
[PrinterFunctions PrintTextWithPortname:portName portSettings:portSettings heightExpansion:heightExpansion widthExpansion:widthExpansion textData:textData textDataSize:[textNSData length]];
free(textData);
}
Would love some help if possible. :) Thanks so much.
This is the main bit I think I would need from the StarIO Text formatting doc...
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
array_hieghtExpansion = [[NSMutableArray alloc] init];
[array_hieghtExpansion addObject:@"1"];
[array_hieghtExpansion addObject:@"2"];
[array_hieghtExpansion addObject:@"3"];
[array_hieghtExpansion addObject:@"4"];
[array_hieghtExpansion addObject:@"5"];
[array_hieghtExpansion addObject:@"6"];
array_widthExpansion = [[NSMutableArray alloc] init];
[array_widthExpansion addObject:@"1"];
[array_widthExpansion addObject:@"2"];
[array_widthExpansion addObject:@"3"];
[array_widthExpansion addObject:@"4"];
[array_widthExpansion addObject:@"5"];
[array_widthExpansion addObject:@"6"];
array_alignment = [[NSMutableArray alloc] init];
[array_alignment addObject:@"Left"];
[array_alignment addObject:@"Center"];
[array_alignment addObject:@"Right"];
}
return self;
}
and
int heightExpansion = [pickerpopup_heightExpansion getSelectedIndex];
int widthExpansion = [pickerpopup_widthExpansion getSelectedIndex];
© Stack Overflow or respective owner