I am developing a POS application for my company, and I have to print to a receipt printer. Printer model Epson Thermal printer paper width 80 mm. My java thermal printer code not able to print long receipt(more than A4 sheet size). Its work fine normally, but in case where there is paper size more than A4 in pdf file then it generate half print. My code is under mentioned
PrinterJob job = PrinterJob.getPrinterJob();
PDDocument document = null;
try {
document = PDDocument.load(temp);
for (int i=0;i<document.getNumberOfPages();i++) {
PDDocument doc = new PDDocument();
doc.addPage(document.getPage(i));
job.setPageable(new PDFPageable(doc));
job.print();
doc.close();
}
document.close();
Obs: temp is a temporary file in format PDF. I try define page but is not working
Paper paper = new Paper();
paper.setSize(paper.getWidth(), paper.getHeight());
I also try define MediaPrintableArea but is not working because resets text to fit in A4 does not reset the paper size.
Thanks to anyone who can help