I am using PersonaC30 card printer to print my Jpanel data on card. My print method is working fine with paper printer but when i print with card printer its not printing my data. Although its printing well externally but its not working with my application please someone help me out if any of you have work with card printing i am trying since 2 days but no result. here is my code.
private void printCard(){
PrinterJob printjob = PrinterJob.getPrinterJob();
printjob.setJobName(" TESSCO CUSTOMER CARD ");
printjob.setPrintable (new Printable() {
public int print(Graphics pg, PageFormat pf, int pageNum){
Paper card = pf.getPaper();
// card.setImageableArea(0, 0, 153, 243);
card.setSize(243, 154);
pf.setPaper(card);
pf.setOrientation(PageFormat.LANDSCAPE);
if (pageNum > 0){
return Printable.NO_SUCH_PAGE;
}
Graphics2D g2 = (Graphics2D) pg;
g2.translate(pf.getImageableX(), pf.getImageableY());
g2.translate( 0f, 0f );
jLayeredPane2.paint(g2);
return Printable.PAGE_EXISTS;
}
});
if (printjob.printDialog() == false)
return;
try {
printjob.print();
}
catch (PrinterException ex) {
System.out.println("NO PAGE FOUND."+ex);
}
}
Thanks