Quantcast
Channel: Programação - GUJ
Viewing all articles
Browse latest Browse all 33093

Setar tamanho por parâmetro em JAVA

$
0
0

@Cleiton_Souza1 escreveu:

Boa tarde Pessoal,

Gostaria de saber como posso fazer para setar um tamanho de papel específico. Atualmente faço da forma abaixo. Porém, o comando dessa forma ele pega o tamanho padrão da etiqueta. Alguém pode me ajudar, por favor?

public void seleciona_impressora(String nome_impressora,JasperPrint jasperPrint){
try{
PrintService serviceFound = null;
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);

for(PrintService service:services){
    if(service.getName().trim().equals(nome_impressora.trim()))
        serviceFound = service;      
}  
if (serviceFound == null)
	JOptionPane.showMessageDialog(null,"Impressora não encontrada !");

		JRExporter exporter = new JRPrintServiceExporter();
		exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
                    exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, serviceFound.getAttributes());
                    //exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET,printRequestAttributeSet );                                          

		exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE);
		exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.FALSE);
		exporter.exportReport();                      
}catch (Exception e){    
}

}

Mensagens: 1

Participantes: 1

Ler tópico completo


Viewing all articles
Browse latest Browse all 33093


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>