star-micronics / StarPRNT-SDK-iOS-Swift

StarPRNT SDK for iOS including libraries for supporting application development for Star printers.
https://www.star-m.jp/products/s_print/sdk/starprnt_sdk/manual/ios_swift/en/index.html
Other
41 stars 7 forks source link

Is there a function to align left and right on a single line or column? or how to print like this design? #10

Closed 5h4ngho closed 2 years ago

5h4ngho commented 2 years ago

I am using the mc-print3 model I want to display the menu on the left and the price on the right

cloudPRNT seems to have a column function. (https://www.star-m.jp/products/s_print/CloudPRNTSDK/Documentation/en/articles/markup/command_column.html?tabs=tabid-2)

But in the SDK's documentation: I was only able to find the sort function for an entire line.

I tried using "horizontalTab", but this function could not place the price on the far right.

I have attached a photo of the printed receipt as an example. (Pictures downloaded from the Internet) As in the attached photo, I would like to know if there is a function that can be printed out right-aligned even if the number of prices increases image 8

gare-bear commented 2 years ago

@5h4ngho Our other SDKs do not have a column function. This is a unique feature of the CloudPRNT SDK that could be implemented in our other SDKs, but has not at this time.

That being said, horizontal tab is still the most applicable approach to achieve left/right columns. Assuming the above is printed as plain text, and no font size changes have been made, up to 48 characters per line can be printed on a 3" width printer like the mC-Print3. The Horizontal tab tab command takes this into consideration when setting tabs.

So let's say you want to set a price on the right side, you need to know how many chars your price is: $1.00 - Horizontal tab at position 43 😁(48 - 5 characters, so it fits on the same line) $10.00 - tab at 42 (48 - 6, so it fits on the same line as other text) $100.00 - tab at 41 $1000.00 - tab at 40

I'm oversimplifying, but I hope this gets the point across. If you post your command builder and the horizontal tabs you've tried, I can give some better suggestions.

5h4ngho commented 2 years ago

It helpful. Thank you very much