求助pb自定义打印纸张。。。
我的打印机是EPSON TM-U210D Receipt ,在打印时如果数据少的话(如两行),只用把有数据地方打印出来即可,可每次都是有很长的空白内容。请问怎样才能设置一个自定义的高度,我只打印有数据的高度?急 [em04] <P>怎么没有人恢复阿,难道大家都不用pb了吗?</P> [em07] environment env<BR>integer rtn<BR>rtn = GetEnvironment(env)<BR>IF rtn <> 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> environment env<BR>integer rtn<BR>rtn = GetEnvironment(env)<BR>IF rtn <> 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>定义下面自定义函数,然后在程序中调用。<BR>environment env<BR>integer rtn<BR>rtn = GetEnvironment(env)<BR>IF rtn <> 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]
