Question

I have established printer connection with my ipad , Now I want to set formate of receipt like alignment, horizontal tab, font size logo settings and all the things which is required in my receipt, please any one can help me how can use POS commands in Objective-c for it?

Thanks

Was it helpful?

Solution

Star has a programming manual you can download here: http://www.starmicronics.com/support/Mannualfolder/linemode_cm_en.pdf

The commands referenced in the Line Mode manual need to be converted into bytes and then sent to the printer. The StarIO iOS SDK package you downloaded has a manual called "README_StarIO_POSPrinter_iOS_SDK.pdf". ( http://www.starmicronics.com/absolutefm/absolutefm/afmviewfaq.aspx?faqid=175 ) Did you check out pages 9-15? The StarIO framework is explained here.

Page 13 shows you how to write to the port using a byte array, but make sure you add StarIO.framework and open the communication port first.

From the manual:

//Set a byte array to send to the printer
//command = { A, B, C, D, Feed 3mm, Full Cut}
unsigned char command = {0x41, 0x42, 0x43, 0x44, 0x1B, 0x7A, 0x00, 0x1B, 0x64, 0x02};

Uint bytesWritten = 0;

@Try
{ 
   While(bytesWritten < (sizeof command)) 
   {
    bytesWritten += [port writePort: command : bytesWritten : sizeof command - bytesWritten];
   }
}
@Catch(PortException)
{
   //There was an error writing to the port
}

Also described is how to close ports (make sure you close every opened port) and getting printer status.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top