How to set different font size in same line for ticket template

Hi All,

Need advice regarding the ticketing template.
I want to print different font size in same line. like picture below?
How to do that? I am not using html format in ticketing template

“Grand total” has smaller font size than “302.800”


Please advice.
Thanks in advance

You pretty much have to use html or document printer to do that.

Hi kendash,
thanks for the response.
is there any sample ticket template for document printer? or just default format
I am not prefer to use html format.

Why not prefer html? I’m just curious.


I am not prefer html because currently my ticket template almost finished, just missing those part.
AFAIK if Im using html, I need to made a new code and to writing the table, div, font-size, css etc which is takes some time.
For document printer, Im still dont know yet how the format.

Simple answer is you cannot do what you ask with ESCPOS mode.
You can set size of a line of text but not sections within a line.
This mode sends the letters digitally without rendering in driver. The line size can be set as samba will send a standard set of commands defining that line as part of the process.
This is also why the font cannot be changed unless printer has option within it’s chip as again the process is sending characters without formatting.
HTML and presumeably document printer mode will be rendering the print on the computer ‘rasterising’ the page into an ‘image’ rather than characters.
Think of it as notepad vs word or csv vs excel.
The basics are similar but the latter has a bunch of extras.
This will be due to in days gone by thermal printers we’re the method for fast printing and only supported this fast process of sending characters digitally. With paster printers topping 300mm/s even for imahe/rasterised prints we can not use HTML and more fancy printing layouts but ou need to code more in template to create the layout before sending to printer.
This too is why previously to print the logo you would have needed to process it to basic BMP with printer toll.and load it into nvram on printer and send the command to tell printer to output the image. Now with faster printers this process can be done on the fly. If you try printing a image using the BMP line method on an older printer you will realize the different it ones made using Epos mode for printing when everything prints quick then it slows right down for the image. Now days it’s almost seamlessly quick.

Document Printer requires you to redo the template in a different format too.

Personally I prefer Document Printer just as it gives more flexibility. But HTML is easier for most to handle.

Actually been wanting to say something but didn’t want to confuse this topic as you are correct in that changing size within a line is not possible in ESC/POS mode in SambaPOS.

However, I would say it IS possible in the ESC/POS language, just the way it’s implemented in SambaPOS where each command is line based makes it not possible. I’m sure it’s down to the way it is parsed in the printer template while making it as easy as possible to edit.

The example printout posted above was done using ESC/POS language, you can tell as it’s using printer fonts.

So if everything was simple, I’d also like to be able to do this in ESC/POS templates, a few times I’d thought it would be nice to be able to, but far from an important feature and we have better formatting options now with Document Printer and HTML. I’m sure @emre implemented the way he has for a reason to make editing more simple for the majority of users over having it for some advanced users.

However as a future thought about possible way it could be accomplished in a future release, would it be possible to implement something like an “inline” <XCT> tag, that would allow changing text size mid line? (unless it actually does work currently - I haven’t tried!)


I was going to say it might be possible if samba supported inline commands and suggest maybe alternative to try <EB><DB> inline although don’t think it would work.

Although even if inline commands were supported i would doubt you would get nice centeral horizontal aligned like in picture. Expect if anything you would get top aliged which would t look best in my mind. Oh it’s bottom alighed in picture. Either way would expect some querky alignment issues if changed size inline.

1 Like

Hi All,

Thank you for your all answer and explanation.
I am new using sambapos here, just continue my ex-teammates work who already quit the project.
So if ESC/POS template are able to change the font size inline it would be better, so I dont need to create new template in html/doc format.

Anyway thanks all for this discussion, I need to try to using html format.

HTML or Document Printer option will give allot more power for font and layout etc.
Id recommend just double checking it prints at acceptable speed as depending on the printer these may print slower vs ESC/POS template.
Another thing to note - although I have never used HTMl or Document template method is you may need to keep a separate ESC/POS template for your drawer kick and any other special commands as not sure if these are supported in a HTML template, may be in Document but not sure.