Rodo o aplicativo se comunicando com uma impressora compartilhada em uma máquina windows,
rodando o aplicando pelo windows, a impressão sai correta, mas quando rodo o aplicativo em um linux, se comunicando pelo smb, a impressão sai falhada, “faltando partes”, pensei que poderia ser margem, dei uma mexida no código, continua saindo falho, imprime só o meio do relatório. E o estranho que no windows imprime certo. Sei que aqui não é fórum de linux, mas como estou programando em java, alguém poderia me dar uma idéia do que posso fazer, ou tentar.
Obrigado.
segue o código
JasperPrint jasperPrint = JasperFillManager.fillReport(diretorioProjetos, parametros, getConexao().getConnection());
getConexao().close();
PrinterJob job = PrinterJob.getPrinterJob();
/* Create an array of PrintServices */
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
int selectedService = 0;
/* Scan found services to see if anyone suits our needs */
for (int i = 0; i < services.length; i++) {
if (services[i].getName().toUpperCase().contains("HPD1360")) {
/*If the service is named as what we are querying we select it */
selectedService = i;
}
}
job.setPrintService(services[selectedService]);
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
MediaSizeName mediaSizeName = MediaSizeName.ISO_A4;
printRequestAttributeSet.add(mediaSizeName);
printRequestAttributeSet.add(new MediaPrintableArea(
0f, 0f,
85f,
54f, Size2DSyntax.MM));
//MediaSize.findMedia(85f, 54f, Size2DSyntax.MM);
printRequestAttributeSet.add(new Copies(1));
JRPrintServiceExporter exporter;
exporter = new JRPrintServiceExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
/* We set the selected service and pass it as a paramenter */
exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE, services[selectedService]);
exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, services[selectedService].getAttributes());
exporter.setParameter(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET, printRequestAttributeSet);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.FALSE);
exporter.exportReport();