Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.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 图像传输至Intermec PM4i打印机,然后打印_Image_Fingerprint_Intermec - Fatal编程技术网

Image 图像传输至Intermec PM4i打印机,然后打印

Image 图像传输至Intermec PM4i打印机,然后打印,image,fingerprint,intermec,Image,Fingerprint,Intermec,我用指纹上传,然后用pcx格式打印图像 步骤1使用TCP端口将图像上载到打印机,我使用命令: IMAGE LOAD "bigfoot.1",1746,""\r\n 打印机返回消息OK。 然后我使用套接字将bigfoot.1的字节数据发送到打印机 步骤2打印大脚怪的图像。1: PRPOS 200,200 DIR 3 ALIGN 5 PRIMAGE "bigfoot.1" PRINTFEED RUN 问题出现时,打印机返回消息“未找到图像”。所以我提出了上传失败的可能性。所以我打开软件Print

我用指纹上传,然后用pcx格式打印图像

步骤1使用TCP端口将图像上载到打印机,我使用命令:

IMAGE LOAD "bigfoot.1",1746,""\r\n
打印机返回消息OK。 然后我使用套接字将bigfoot.1的字节数据发送到打印机

步骤2打印大脚怪的图像。1:

PRPOS 200,200
DIR 3
ALIGN 5
PRIMAGE "bigfoot.1"
PRINTFEED
RUN
问题出现时,打印机返回消息“未找到图像”。所以我提出了上传失败的可能性。所以我打开软件PrintSet4来检查图像,图像已经存在于TMP中。奇怪!!! 最后,我用PrintSet4代替我的socket应用程序来上传图像,在添加文件并应用之后,我使用step2print命令来打印图像,效果很好! 以下是上载图像的C代码:

public void SendFile(string filePath, string CR_LF)
{
    FileInfo fi = new FileInfo(filePath);
    using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
    {
        byte[] byteFile = new byte[fs.Length];
        string cmd = "IMAGE LOAD \"" + fi.Name + "\"," + byteFile.Length.ToString() + ",\" \"" + CR_LF;
        ClientSocket.Send(encode.GetBytes(cmd));
        fs.Read(byteFile, 0, byteFile.Length);
        Thread.Sleep(1000);
        ClientSocket.Send(byteFile);
    }
}

我已经修改了你的代码并使用了串口

public void SendFile(string filePath)
{
    SerialPort port = new SerialPort("COM3", 38400, Parity.None, 8, StopBits.One);
    port.Open();
    FileInfo fi = new FileInfo(filePath);
    using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
    {
        byte[] byteFile = new byte[fs.Length];
        // string cmd = "IMAGE LOAD \"" + fi.Name + "\"," + teFile.Length.ToString()+                     ",\"\"" + CR_LF;
        string cmd = "IMAGE LOAD " + "\"" + fi.Name + "\"" + "," + byteFile.Length.ToString() + "," + "\"S\"";

        port.WriteLine(cmd);
        fs.Read(byteFile, 0, byteFile.Length);
        port.Write(byteFile,0,byteFile.Count());
        int count = byteFile.Count();
        int length = byteFile.Length;
    }
}

所以我注意到问题在于使用CR\U LF。相反,我使用了port.WriteLinecmd,其作用与添加行分隔符相同。而且效果很好

TCP端口呢?在我的应用程序中,PC和打印机之间的距离很长,因此我需要使用TCP而不是串行端口。您找到如何通过TCP网络上传PCxMonocrome黑白自定义图像的答案了吗?我有完全相同的问题。我提交图像加载命令、newlineLF、写入数据字节以及其他DirectProtocol命令。图像未存储在打印机中。