I got problems for printing Chinese words in sales tickets. They are not aligned properly. (Sample printout)
Instead of using "text align ='left' length='17' for printing, is it possible to print the contents similar to using table, tr, td tags of html?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thx for your feedback. The standard template already set the righ alignment for the price and value. I guess the problem is caused by the double byte size for Chinese characters comparing with single byte size for normal characters. :-(
Any clues to solve the problem?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried this but find it doesn't work well when you have product names of more than a few characters. I've found a way that's much simpler - just print each product line on 2 lines - one for the product name, the second for the prices / quantity.
I used the modified header line from the example above as you need to change the length attributes slightly so they line up.
Yeah I agree about the wasting of paper and look, however in this case it was a migration from another platform with 1000+ products all with long Chinese names, so it solved it well for that.
I think it is still a good option to have anyway so worth sharing. I've also noticed some large retailers using a similar format to combat the same type of issue with long names.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got problems for printing Chinese words in sales tickets. They are not aligned properly. (Sample printout)
Instead of using "text align ='left' length='17' for printing, is it possible to print the contents similar to using table, tr, td tags of html?
for the price and value to use a right alignment.
chris J.
Hi Chris,
Thx for your feedback. The standard template already set the righ alignment for the price and value. I guess the problem is caused by the double byte size for Chinese characters comparing with single byte size for normal characters. :-(
Any clues to solve the problem?
I don't use Chinese, but I use Korean word, so I solved that problem by modified Printer.Ticket.xml file.. like below
#set ($longestName = 0)
#set ($longestPriceTax = 0)
#set ($shortestPriceTax = 100)
#set ($shortestValue = 100)
#set ($longestMultiply = 0)
#set ($longestValue = 0)
I did some modified that code written by other developer who use Chinese.
Still has some bugs....anyway you can align Chinese word on receipt .
:)
It prints like this
I tried this but find it doesn't work well when you have product names of more than a few characters. I've found a way that's much simpler - just print each product line on 2 lines - one for the product name, the second for the prices / quantity.
I used the modified header line from the example above as you need to change the length attributes slightly so they line up.
Here is the code:
It prints like this
Hi Fanzam,
Yeah I agree about the wasting of paper and look, however in this case it was a migration from another platform with 1000+ products all with long Chinese names, so it solved it well for that.
I think it is still a good option to have anyway so worth sharing. I've also noticed some large retailers using a similar format to combat the same type of issue with long names.