如何导入和导出ZPL文件

时间:2017-09-11 14:38:55

标签: java rest maven zebra-printers zpl-ii

我需要导入一个带有多个标签的ZPL文件,并导出带有单个标签的新zpl文件。我创建了一个maven库ZEBRA ZPL,但我找不到导入和导出的源代码。有人可以给我一些建议吗? 提前谢谢!

public class ZplRestImpl {
    private String path;

    public static void main(String[] args) {

       String path="C:\\Users\\Irdi\\Downloads\\STCPZ000001722412207.prn";
        File file = new File(path);
        FileInputStream fis = null;
        String zplString="";

        try {
            fis = new FileInputStream(file);

            System.out.println("Total file size to read (in bytes) : "
                + fis.available());

            int content;
            while ((content = fis.read()) != -1) {

                zplString+=(char) content;
            }


            String[] zplA= zplString.split("^MM");
            String[] zplB;

            for(int i=0;i<zplA.length;i++) {


                System.out.println(zplA[i]);

            }


        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fis != null)
                    fis.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }

}

0 个答案:

没有答案