帮助-阿拉伯语打印问题 [英] Help - Arabic Print Ploblem

查看:119
本文介绍了帮助-阿拉伯语打印问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我要使用C#(.NET 2.0)打印出Arbic收件人打印内容.
请通过串行接口查看以下每个代码.

Hi
I`m going to print out Arbic recipt print by using C#(.NET 2.0)
Please see each code as below by Serial interface.

byte[] cutemp = Encoding.GetEncoding(1256).GetBytes(content);
serialPort.BaseStream.WriteTimeout = 1500000;
serialPort.BaseStream.Write(cutemp, 0, cutemp.Length);
serialPort.BaseStream.Flush();



但是,问题是Arbic反向打印了.(上朝下)
当将英语和Arbic混合使用时,英语打印效果很好,只有阿拉伯语被反转了.
当我检查转换后的字节排列时,转换后的字节已在编码后反转.
例如,如果54321(请假设它们是阿拉伯语)并编码这些字母,则
字节排列[1] [2] [3] [4] [5]代替[5] [4] [3] [2] [1],类似这样.

有人帮我吗?!!
如果我不解决此问题,我的老板正等着我杀死我.



BUT, the problem is that Arbic print out in reverse.(Up side down)
When mix English and Arbic, English print out well, only arabic has been reversed.
As I checked converted Byte arrangment, converted byte has been reversed after encoding.
for example, if 54321(please imagine these would be Arabic) and encoding these letters,
Byte arrangement [1][2][3][4][5] instead of [5][4][3][2][1], something like this.

anybody help me out?!!
My boss is waiting for me to kill if I don`t fix this problem.

推荐答案

这是否合乎逻辑?英语是LTR(从左到右)和阿拉伯语RTL(从右到左),由于串行端口不支持html之类的功能,因此您必须自己做.我猜想您可以在使用BigEndianUnicode获得字符串后将其反转,因此反转字节数组可以对其进行更正,从而可以在接收端将其读取为小端序.当然,这仅适用于阿拉伯文本.

http://www.tertullian.org/rpearse/RightToLeft_Syriac/right_to_left.htm [ ^ ]

http://msdn.microsoft.com/zh-cn/library/system.text.encoding.bigendianunicode%28v = VS.71%29.aspx [ http://msdn.microsoft.com/zh-cn/library/system.text.encoding.bigendianunicode%28v = VS.71%29.aspx [
Isn''t it kind of logical? The English language is read LTR (left to right) and Arabic RTL (right to left) and since the serial port doesn''t have support for something like like html does this is something you have to do yourself. I guess you could reverse the string after you get it with BigEndianUnicode, so reversing the byte array is correcting it, making it possible to read it as little endian on the receiving side. This would be for the arabic text only of course.

http://www.tertullian.org/rpearse/RightToLeft_Syriac/right_to_left.htm[^]

http://msdn.microsoft.com/en-us/library/system.text.encoding.bigendianunicode%28v=VS.71%29.aspx[^]

http://msdn.microsoft.com/en-us/library/system.text.encoding.bigendianunicode%28v=VS.71%29.aspx[^]

Good luck!


我会给你另一个选择.此收据打印机是否打印单色位图图像?

为什么不将阿拉伯文本写入位图,然后将位图发送到打印机?这将确保您编写的文本将是要打印的文本.您甚至可以将其翻转,反转或将其旋转90度,因为我们都知道客户无论如何最终都会想要它.

自从我上次这样做以来已经过去了大约五年,它是通过串行电缆或Windows CE设备上的蓝牙在Printech打印机上进行的.与文本相比,图像的打印速度较慢.如果您的客户用脚踩脚等待收据,则情况会更加复杂,但是自从我这样做以来,传输速度可能会有所提高.但是也有一种解决方法.某些打印机具有一个内存缓冲区,您可以在其中加载图像.如果在内存缓冲区中为诸如总计"或小计"之类的词预加载阿拉伯图像,则您所要做的就是发送命令,并且无需发送整个位图即可打印项目.

瑞安(Ryan)
I''ll give you another option. Does this receipt printer print monochrome bitmap images?

Why not write the Arabic text to a bitmap, then send the bitmap to the printer? This will guarantee that the text you write will be the text that prints. You can even flip it, reverse it, or turn it 90 degrees, because we both know that the customer is going to want that eventually anyway.

It''s been about five years since I last did this, and it was on a Printech printer over a serial cable or bluetooth from a Windows CE device. Images were slow to print compared to text. This will be compounded if you have a customer tapping his foot waiting for a receipt, but transmission speed might have improved since I did this. But there is a way around this as well. Some printers have a memory buffer that you can load with images. If you preload Arabic images for words like "Total" or "Subtotal" in the memory buffer, all you have to do is send a command, and the items will print without having to send the whole bitmap.

Ryan


这篇关于帮助-阿拉伯语打印问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆