无法打印汉字???急,急,急!!!!
客户用的是TM-U300A票据打印机(没有自带汉字库),怎么用直写端口的方法打印出中文呢。。。。
请高手们指教!!!能否给个实例。。。。。
小弟的QQ号码是:106211053
问题点数:100、回复次数:9Top
1 楼paranoia190(190)回复于 2005-08-03 11:06:28 得分 50
with Printer do
begin
BeginDoc;
Canvas.TextOut(100,100,'汉字');
EndDoc;
end;Top
2 楼hqhhh(枫叶)回复于 2005-08-03 11:56:31 得分 0
打印机支持不支持!Top
3 楼czw980641(小黑)回复于 2005-08-03 12:03:24 得分 0
回复人: paranoia190(190)
with Printer do
begin
BeginDoc;
Canvas.TextOut(100,100,'汉字');
EndDoc;
end;
我试了之后可以打印出中文了(先谢谢了),但有一点就是打印完之后会自动切纸,能否让切纸这个功能由我们自己编程控制呢????Top
4 楼czw980641(小黑)回复于 2005-08-03 15:54:38 得分 0
还有一个问题,打印的内容多了,后面就变成了乱码。。。Top
5 楼opqhjb(又回来做程序员了!苦呀!)回复于 2005-08-03 17:07:59 得分 0
这是机子的问题了!!!!!Top
6 楼paranoia190(190)回复于 2005-08-03 17:15:48 得分 0
切纸是什么??走纸?你说详细一点。
乱码应该是被截断了。
你看一下程序,打印前把打印的内容SHOW一下呢,Top
7 楼operfume(橘子香水)回复于 2005-08-03 20:53:53 得分 0
原来我也遇到类似的问题,是驱动打印驱动程序没有安装准确。切纸是自动的,结束打印后会自动切纸。Top
8 楼zhilunchen(他山居士)回复于 2005-08-03 21:32:38 得分 50
这是我做的套打程序,自动走纸,切纸,(要求打印要与LQ-1600K兼容):
//**************************销售单相关打印*************************************/
procedure TfrmDispatchLists.mnDtdClick(Sender: TObject);
var
tYear,tMonth,tDay:Word;
k:Integer;
tLine1,tLine2,tLine3,tLine4,tLine5:String;
tpd:gPrintDataType;
begin
if not rpDispatch.SetToDefaultPrinter then
begin
Application.MessageBox('没有发现打印机!','警告',MB_OK+MB_ICONSTOP);
Exit;
end;
if (wwDBGrid1.SelectedList.Count=0) then
begin
Application.MessageBox('请选择要打印的记录!','警告',MB_OK+MB_ICONSTOP);
Exit;
end;
DecodeDate(dtmBaseOp.dhRq.Value,tYear,tMonth,tDay);
with dtmBaseOp,wwDBGrid1,wwDBGrid1.DataSource.dataset,rpDispatch do
begin
DisableControls;
for k:= 0 to SelectedList.Count-1 do
begin
GotoBookmark(SelectedList.items[k]);
Freebookmark(SelectedList.items[k]);
tpd[1]:=dhKhmc.Value;
tpd[2]:=IntToStr(tYear);
tpd[3]:=IntToStr(tMonth);
tpd[4]:=IntToStr(tDay);
tpd[5]:='';
// tpd[5]:=dhdDh.Value;
tLine1:=CrtLine(tpd,1);
tpd[1]:=dhdSpbm.Value;
tpd[2]:=dhdSpmc.Value;
if Length(dhdGg.Value)>14 then
tpd[3]:=Copy(dhdGg.Value,1,14)
else
tpd[3]:=dhdGg.Value;
tpd[4]:=dhdDw.Value;
tpd[5]:=Trim(Format('%8.0f',[dhdSl.Value]));
if dhdPfjA.Value<>0 then
tpd[6]:=Trim(FloatToSTr(dhdPfjA.Value))
else
tpd[6]:='';
if dhdKlA.Value<>0 then
tpd[7]:=Trim(Format('%8.0f',[dhdKlA.Value]))+'%'
else
tpd[7]:='';
if dhdSjA.Value<>0 then
tpd[8]:=Trim(FloatToSTr(dhdSjA.Value))
else
tpd[8]:='';
tLine2:=CrtLine(tpd,2);
tpd[1]:=JeToRMB(dhdJe.Value,-5);
tpd[2]:=JeToRMB(dhdJe.Value,-4);
tpd[3]:=JeToRMB(dhdJe.Value,-3);
tpd[4]:=JeToRMB(dhdJe.Value,-2);
tpd[5]:=JeToRMB(dhdJe.Value,-1);
tpd[6]:=JeToRMB(dhdJe.Value,1);
tpd[7]:=JeToRMB(dhdJe.Value,2);
tpd[8]:=Trim(Format('%8.2f',[dhdJe.Value]));
tLine3:=CrtLine(tpd,3);
if Length(dhdCd.Value)>10 then
tpd[1]:=Copy(dhdCd.Value,1,10)
else
tpd[1]:=dhdCd.Value;
tpd[2]:=dhdBz.Value;
tpd[3]:=dhdPh.Value;
if dhdYxq.Value<>0 then
tpd[4]:=dhdYxq.AsString
else
tpd[4]:='';
tpd[5]:=Trim(FloatToSTr(dhdPfj.Value));
tpd[6]:=Trim(Format('%8.2f',[dhdBzlsj.Value]));
tLine4:=CrtLine(tpd,4);
// tpd[1]:=dhCgy.Value;
tpd[1]:=dhdDh.Value;;
tpd[2]:=dhFh.Value;
tpd[3]:=dhSk.Value;
tpd[4]:=dhBmmc.Value;
tpd[5]:=dhKp.Value;
tLine5:=CrtLine(tpd,5);
BeginDoc;
WriteStr(#27#64); //RESET
WriteStr(#27#51#4); //行距 4/180inch
WriteStr(#27#67#124); //页长 125 rows
WriteStr(#27#66#26#53#69#83#96#0); // 设定垂直制表位
WriteStr(#27#68#1#0); //第一行水平位
WriteStr(#11);
WriteStr(#9);
WriteStr(tLine1);
WriteStr(#27#68#1#0); //第二行水平位
WriteStr(#11);
WriteStr(#9);
WriteStr(tLine2);
WriteStr(#27#68#1#0); //第三行水平位
WriteStr(#11);
WriteStr(#9);
WriteStr(tLine3);
WriteStr(#27#68#1#0); //第四行水平位
WriteStr(#11);
WriteStr(#9);
WriteStr(tLine4);
WriteStr(#27#68#1#0); //第五行水平位,指定横向制表未志
WriteStr(#11); //垂直制表
WriteStr(#9); //横向制表
WriteStr(tLine5);
WriteStr(#12); //换页
EndDoc;
end;
SelectedList.clear;
EnableControls;
wwDBGrid1IButton.Caption:='全选'; { Reenable controls }
end;
end;Top
9 楼lcy98162(影子)回复于 2005-08-03 22:29:19 得分 0
一般乱码是因为一次发送的打印指令太多了,一般在打印6个汉字后在暂停一下才行Top




