how to import and export a ZPL file

696 views Asked by At

I need to import a ZPL file with multiple label on it and export new zpl file with single label. I founded a maven library ZEBRA ZPL but im not finding the source code for import and export. Can someone give me some advice??
Thank you in advance!

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

There are 0 answers