rkone / sharpzebra

A .net library that simplifies printing to Zebra printers in their native EPL2/ZPL languages without needing to know EPL2 or ZPL.
MIT License
89 stars 34 forks source link

text to graphic support #19

Closed viktoraskas closed 3 years ago

viktoraskas commented 3 years ago

Hi,

can you add text to graphic conversion support? I try print text in my local language, but printer just ignores that chars - ąčęėįšųūžĄČĘĖĮŠŲŪŽ. It would be great to have function converts text to graphic field.

Thank You

rkone commented 3 years ago

I had something like that for EPL, but it would never be a great solution. The proper way to handle it depends a little on the printer you have. I do have the option to choose a different codepage other than the default 850, that may work for you.
To use that, you'd do something like this: res.AddRange(ZPLCommands.TextWrite(10, 150, ElementDrawRotation.NO_ROTATION, ZPLFont.STANDARD_BOLD2, 15, 10, "ąčęėįšųūžĄČĘĖĮŠŲŪŽ", (int)Codepage8KDU.Germany));

Finally, StackOverflow had an answer here that said Encoding.UTF8 was a simple solution. This would require a change to the library, maybe more method overrides. I'm a little hesitant to do that since it's already a bit insane with overrides already, but let me know what your testing finds out!

rkone commented 3 years ago

Actually, your request is already in ZPL also, I just forgot. Check out ZPLCommands.CustomStringWrite