Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 如何在TSC打印机中打印图像_Image_Printing_Barcode_Thermal Printer_Barcode Printing - Fatal编程技术网

Image 如何在TSC打印机中打印图像

Image 如何在TSC打印机中打印图像,image,printing,barcode,thermal-printer,barcode-printing,Image,Printing,Barcode,Thermal Printer,Barcode Printing,我正在用TSC ME240打印机打印标签。 标签设计有公司徽标、文本部分和条形码。 条形码和文本打印得很好,但徽标打印得不好,徽标是存储在打印机内存中的.bmp图像 每次打印标签时,我都会收到一条弹出消息“无法打开文件” 以下是我的部分代码: openport("printerName"); setup("80 mm", "51 mm", "4", "15", "0", "3 mm", "0"); clearbuffer(); // LOGO downloadpcx("l

我正在用TSC ME240打印机打印标签。 标签设计有公司徽标、文本部分和条形码。 条形码和文本打印得很好,但徽标打印得不好,徽标是存储在打印机内存中的.bmp图像

每次打印标签时,我都会收到一条弹出消息“无法打开文件”

以下是我的部分代码:

  openport("printerName");
  setup("80 mm", "51 mm", "4", "15", "0", "3 mm", "0");
  clearbuffer();

  //  LOGO
  downloadpcx("logo-bmp.PCX", "logo-bmp.PCX");
  sendcommand("PUTPCX 19,15,\"logo-bmp.PCX\""); 
  printlabel("1", "1");
  closeport();
我还尝试将图像存储在应用程序中,但仍然收到相同的消息。我想知道我是否需要改变打印速度?打印机是否可能因为打印速度过快而无法打印图像?但如果打印速度设置过低,则贴纸可能会燃烧

编辑:

我将打印机配置为较低的打印速度,但这并没有解决我的问题

然后我尝试使用他们的样本图像,结果打印得很好。我的图像是5kb,他们的图像是6kb,所以我知道大小与此无关


对此问题的任何意见都将不胜感激。这里没有想法了。

我也有同样的问题,下面的代码解决了这个问题

mydll = cdll.LoadLibrary('k:\Work\SCANNER\Printer\TSCLIB_V0201_x64\TSCLIB.dll')
print 'Start Printing.'
mydll.openport("TSC TA300")
mydll.setup("32","25","2","10","0","0","0")
mydll.clearbuffer()

# LABEL TEMPLATE
mydll.sendcommand("SIZE 50.8 mm,25.4 mm")
mydll.sendcommand('GAP 3 mm,0 mm')
mydll.sendcommand('DIRECTION 0')
mydll.sendcommand('CLS')
# Draw Label Image
mydll.sendcommand('BOX 12,12,584.4,282,4,19.2')
mydll.sendcommand("QRCODE 417.6,160,H,4,A,0,\"ABCabc123\"")
mydll.sendcommand("TEXT 48,56,\"2\",0,1,1,\"I'm Testing\"")

# Print
mydll.sendcommand('PRINT 1,1')
mydll.closeport()
print 'Finished Printing.'

您的代码应该如下所示:

PrintTSClabel.openport("PrinterName as in Windows");                                 //Driver name of the printer as in Windows
PrintTSClabel.setup("80", "38", "4", "15", "0", "3", "0");                           //Setup the media size and sensor type info
PrintTSClabel.clearbuffer();                                                         //Clear image buffer

PrintTSClabel.downloadpcx(@"C:\USERS\USER\DOWNLOADS\LOGO-BMP.PCX", "LOGO-BMP.PCX");  //Download PCX file into printer
PrintTSClabel.sendcommand("PUTPCX 10,30,\"LOGO-BMP.PCX\"");                          //Drawing PCX graphic

PrintTSClabel.sendcommand("PRINT 1");                                                //Print labels
PrintTSClabel.closeport();                                                           //Close specified printer driver

我从pcx改为bmp。我还将图像缩小了1kb。然后我使用diagtool将新图像上传到打印机

除了删除
downloadpcx
行并将
PUTPCX
更改为
PUTBMP
之外,我的代码没有改变

  openport("printerName");
  setup("80 mm", "51 mm", "4", "15", "0", "3 mm", "0");
  clearbuffer();

  //  LOGO
  sendcommand("PUTBMP 19,15,\"logo-bmp.BMP\""); 
  printlabel("1", "1");
  closeport();

这是因为图像不是TSC打印机支持的BMP格式(1位或256位)。
在Paint as save as BMP中以1位或256位格式打开图像。

我用以下代码解决了问题:

TSCAvity tscDll=新的TSCAvity();
开放端口(“00:19:0E:A2:23:DE”);
设置(100,60,4,15,0,3,0);
tscDll.clearbuffer();
字符串filePath=Environment.getExternalStorageDirectory().toString()+“/Download”;
字符串fileName=“PrintImg2.bmp”;
File mFile=新文件(文件路径、文件名);
tscDll.sendpicture(200200,mFile.getAbsolutePath());
tscDll.printlabel(1,1);
tscDll.closeport();
  • 在android手机上安装示例应用程序,并使用蓝牙将打印机与手机连接
  • TSCAvity”是“tscsdk”中的活动类
  • '00:19:0E:A2:23:DE'将其替换为打印机的MAC地址(与打印机配对后,您将在手机的BT设置中获得该地址)
  • 在这里,我将图像保存在手机的下载文件夹中(adb push path of_img/PrintImg2.bmp/mnt/sdcard/Download)
  • 图像大小取决于图像的分辨率,您可以更改setup()的前两个参数(宽度、高度……)以获得可能的最大大小

pls您是在.net还是java环境下执行此操作的。您使用的是sdk吗?您使用的是什么控件或库