编程论坛's Archiver

app_boy 发表于 2007-9-17 12:09

求助pb自定义打印纸张。。。

我的打印机是EPSON TM-U210D Receipt ,在打印时如果数据少的话(如两行),只用把有数据地方打印出来即可,可每次都是有很长的空白内容。请问怎样才能设置一个自定义的高度,我只打印有数据的高度?急

app_boy 发表于 2007-9-17 12:16

[em04]

app_boy 发表于 2007-9-17 14:01

<P>怎么没有人恢复阿,难道大家都不用pb了吗?</P>

app_boy 发表于 2007-9-18 11:34

[em07]

zxw103556710 发表于 2007-10-7 08:24

environment env<BR>integer rtn<BR>rtn = GetEnvironment(env)<BR>IF rtn &lt;&gt; 1 THEN  return false<BR>if env.OSType=Windows! then //win98!<BR>    return SetPaperSize(ai_Width,ai_Height,ai_Orient)=1<BR>else<BR>    if env.OSType=WindowsNT!  then<BR>        string printerName<BR>        string paperName<BR>        boolean rt<BR>        papername=string(ai_width)+"*" +string(ai_height)<BR>            printerName = space(255)<BR>            rt = GetDefaultPrinter(ref printerName, 255)<BR>            if rt then<BR>            //messagebox("",trim(printerName))<BR>            printername= trim(printerName)<BR>       else<BR>           return false<BR>        end if<BR>          DeleteCustomPaper(ref printerName, ref paperName) //先删除纸张<BR>          rt = AddCustomPaper(ref printerName, ref PaperName, ai_width, ai_height, 0, 0, 0, 0)<BR>          if rt=false then return rt<BR>      rt = SetDefaultpaper(ref printerName, ref paperName, ai_orient)<BR>       return rt<BR>   end if    <BR>end if    <BR>

zxw103556710 发表于 2007-10-7 08:24

environment env<BR>integer rtn<BR>rtn = GetEnvironment(env)<BR>IF rtn &lt;&gt; 1 THEN  return false<BR>if env.OSType=Windows! then //win98!<BR>    return SetPaperSize(ai_Width,ai_Height,ai_Orient)=1<BR>else<BR>    if env.OSType=WindowsNT!  then<BR>        string printerName<BR>        string paperName<BR>        boolean rt<BR>        papername=string(ai_width)+"*" +string(ai_height)<BR>            printerName = space(255)<BR>            rt = GetDefaultPrinter(ref printerName, 255)<BR>            if rt then<BR>            //messagebox("",trim(printerName))<BR>            printername= trim(printerName)<BR>       else<BR>           return false<BR>        end if<BR>          DeleteCustomPaper(ref printerName, ref paperName) //先删除纸张<BR>          rt = AddCustomPaper(ref printerName, ref PaperName, ai_width, ai_height, 0, 0, 0, 0)<BR>          if rt=false then return rt<BR>      rt = SetDefaultpaper(ref printerName, ref paperName, ai_orient)<BR>       return rt<BR>   end if    <BR>end if    <BR>

zxw103556710 发表于 2007-10-7 08:25

<P>定义下面自定义函数,然后在程序中调用。<BR>environment env<BR>integer rtn<BR>rtn = GetEnvironment(env)<BR>IF rtn &lt;&gt; 1 THEN  return false<BR>if env.OSType=Windows! then //win98!<BR>    return SetPaperSize(ai_Width,ai_Height,ai_Orient)=1<BR>else<BR>    if env.OSType=WindowsNT!  then<BR>        string printerName<BR>        string paperName<BR>        boolean rt<BR>        papername=string(ai_width)+"*" +string(ai_height)<BR>            printerName = space(255)<BR>            rt = GetDefaultPrinter(ref printerName, 255)<BR>            if rt then<BR>            //messagebox("",trim(printerName))<BR>            printername= trim(printerName)<BR>       else<BR>           return false<BR>        end if<BR>          DeleteCustomPaper(ref printerName, ref paperName) //先删除纸张<BR>          rt = AddCustomPaper(ref printerName, ref PaperName, ai_width, ai_height, 0, 0, 0, 0)<BR>          if rt=false then return rt<BR>      rt = SetDefaultpaper(ref printerName, ref paperName, ai_orient)<BR>       return rt<BR>   end if    <BR>end if    <BR></P>

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.