This discussion is archived
0 Replies Latest reply: Sep 2, 2011 8:07 AM by 886014 RSS

Print - custom size

886014 Newbie
Currently Being Moderated
Hi all

I'm developing an application that print barcodes on a label printer.
The application use jasper report to generate the barcode, and then print it on a 110x40mm label.

Everithing works fine if the printer is the default system printer.

But, if I change the default system printer, and select the printer by printService class, the label printer print a wrong size for the label.

This is the code:
-----
JRPrintServiceExporter exporter;
exporter = new JRPrintServiceExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);

exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE, printService);
exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, printService.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();
-----

I guess that the problem depends on printRequestAttributeSet.
I tryied to set different media size on it, but nothing seems to work.

I also tryied to set the parameters with print dialog, with no result
job.printDialog(printRequestAttributeSet);

Can you please help me?

Best Regards,
Luca

Edited by: 883011 on 2-set-2011 8.05

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points