I am printing checks with a Java application, I use DocPrintJob
to create the document I print.
The printing does well on the first page. The problem arises when you continue to the next page because as the printer is fed with continuous paper (perforated paper) that is pulled by the tractor; By continuing with the second and subsequent pages, printing starts at a lower and lower position.
Can someone help me solve my problem? I feel it is a matter of the size of the page to print, I do not know how to define it. In the code I define a size, but I see that it does not respect it.
Here my code:
InputStream ff = new ByteArrayInputStream(strLine.getBytes("UTF-8"));
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new Copies(1));
pras.add(new JobName("rptCheque", locale));
pras.add(OrientationRequested.PORTRAIT);
pras.add(new MediaPrintableArea(3, 3, 173, 218, MediaPrintableArea.MM));
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
Doc doc = new SimpleDoc(ff, flavor, null);
DocPrintJob job = service.createPrintJob();
PrintJobWatcher pjw = new PrintJobWatcher(job);
job.print(doc, pras);
pjw.waitForDone();
That is the part that defines the impression.