Comando para acionar a guilhotina

0 respostas
jsf
U
Bom dia Galera alguém ai  usou comando para acionar a guilhotina de impressoras térmica pra mim ajudar,

Estou usando esse codigo abaixo porém, faz a impressão e não corta o papel no final

identar texto pre-formatado em 4 espaços

public static void printArquivo(String toPrint) throws PrintException, FileNotFoundException {

PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();

aset.add(OrientationRequested.PORTRAIT);

aset.add(new JobName(Impressão Arquivos, null));

//PROCURA A IMPRESSORA

PrintService printer = null;

PrintService impressora = PrintServiceLookup.lookupDefaultPrintService();

if(impressora != null) {

PrintService p = impressora;

if (p.getName().equalsIgnoreCase(impressora.toString())) {

String msg = Impressora pronta para imprimir…”+impressora;

sendMsg(MENSAGE_CABECALHO, msg, FacesMessage.SEVERITY_INFO);

printer = p;

}

}

//ENVIA COMO ARRAY DE BYTES PARA IMPRESSORA DESEJADA

DocPrintJob docPrint = impressora.createPrintJob();

FileInputStream stream = new FileInputStream(GUILHOTINA_EPSON +arquivo.toString());

//InputStream stream = new ByteArrayInputStream(toPrint.getBytes());//NOSONAR

DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;

Doc doc = new SimpleDoc(stream, flavor, null);

docPrint.print(doc, aset);

}
Criado 8 de junho de 2017
Respostas 0
Participantes 1