a mi me pasa algo parecido me agarra la impresion como si fuera joja tamaño cartatienen idea de q es lo que pasa?
este es mi codigo
Código Java:
Ver originalpublic class imprimir_individual {
String item_no,ident,country_o,country_o2,qty2,cus,printName
= "ZDesigner 140XiIII Plus"; int count;
item_no=item;
ident=iden;
country_o=country;
country_o2=country2;
qty2=qty;
cus=cust_num;
book.append(new IntroPage(), printJob.defaultPage());
printJob.setPageable(book);
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
for (PrintService printService : services) {
if (count == 0) {//aqui cambio para q tome monbre de impresora, se quta si la impresora es local
printName = printService.getName();
}
count = count + 1;//junto con este
}
aset.add(new PrinterName(printName, null));
services = PrintServiceLookup.lookupPrintServices(null, aset);
for (PrintService printService : services) {
PrintService printers[] = PrintServiceLookup.lookupPrintServices(null, aset);
if (printers.length == 1) {
printJob.setPrintService(printers[0]);
try {
printJob.print();
PrintException.printStackTrace();
}
}
}
}
private class IntroPage
implements Printable {
try {
int [] diasDeMeses = new int [] {31,28,31,30,31,30,31,31,30,31,30,31,30,31};
String [] numeroDeMeses
= new String [] {"",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"}; int mes = fecha.getMonth();
System.
out.
println("mes: "+mes
); int dia = fecha.getDay();
int dia2=0;
int dias = -1;
for( int i = 0; i<mes; i++ ){
dia2=diasDeMeses[i];
dias =dias + dia2;
}
dias += dia;
if(dias_acum.length()==1){
dias_acum="00"+dias_acum;
}
if(dias_acum.length()==2){
dias_acum="0"+dias_acum;
}
int iNumero=fecha.getYear();
int anio = iNumero%10;
g2d2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
g2d2.
setPaint(Color.
black); g2d2.draw(rec_ind);
String julian_ind
= anio
+dias_acum
; Barcode barcode_c = BarcodeFactory.createCode39(cus, false);
barcode_c.setDrawingText(false);
barcode_c.setBarHeight(35);
barcode_c.setBarWidth(1);
//parte de arriba
g2d2.setFont(customerFont);
FontMetrics customerfontMetrics
= g2d2.
getFontMetrics(); g2d2.drawString(customer, 45, 16);
g2d2.drawImage(image_c, 10, 21, null);
g2d2.setFont(julian_iFont);
FontMetrics julian_ifontMetrics
= g2d2.
getFontMetrics(); g2d2.drawString(julian_ind, 64, 70);
////parte de abajo
g2d2.setFont(julian_iFont);
FontMetrics julian_i2fontMetrics
= g2d2.
getFontMetrics(); g2d2.drawString(julian_ind, 64, 200);
g2d2.drawImage(image_c, 10, 150, null);
g2d2.setFont(customerFont);
FontMetrics customer2fontMetrics
= g2d2.
getFontMetrics(); g2d2.drawString(customer, 45, 145);
} catch (OutputException ex) {
Logger.getLogger(imprimir_individual.class.getName()).log(Level.SEVERE, null, ex);
} catch (BarcodeException ex) {
Logger.getLogger(imprimir_individual.class.getName()).log(Level.SEVERE, null, ex);
} return PAGE_EXISTS;
}
}
probe con la configuracion del papel pero ni asi pude
si alguien puede ayudarnos se lo agradecere