I'm trying to print out a jpanel and it's components to a 4X2 label, I'm new to java and I'm not sure were to go next on how to adjust the Paper's imageable height. The following is my code block for printing. I appreciate any help or direction you can point me to.
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setJobName(" Print Component ");
pj.setPrintable (new Printable() {
public int print(Graphics pg, PageFormat pf, int pageNum){
if (pageNum > 0){
return Printable.NO_SUCH_PAGE;
}
return Printable.PAGE_EXISTS;
}
});
if (pj.printDialog() == false)
return;
try {
pj.print();
} catch (PrinterException ex) {
// handle exception
System.out.println(ex);
}
}