Hola chicos, tengo una duda, estoy implementando una impresión de un PDF, lo hago con éste código
Código Java:
Ver original // Se crea el documento
documento.addTitle("Turnos Onvacation");
documento.addSubject("Generado desde Software Turnero");
// Se crea el OutputStream para el fichero donde queremos dejar el pdf.
// Se asocia el documento al OutputStream y se indica que el espaciado entre
// lineas sera de 20. Esta llamada debe hacerse antes de abrir el documento
PdfWriter.getInstance(documento,ficheroPdf).setInitialLeading(1);
// Se abre el documento.
documento.open();
documento.add(new Paragraph(" ON VACATION\n" +
" Con todo incluido y a tu alcance",
FontFactory.getFont("arial", // fuente
10)));
try {
com.
itextpdf.
text.
Image foto
= com.
itextpdf.
text.
Image.
getInstance("logo_small.png"); foto.setAlignment(Chunk.ALIGN_LEFT);
documento.add(foto);
e.printStackTrace();
}
documento.add(new Paragraph("SERVICIO:\n "+servicio,
FontFactory.getFont("arial", // fuente
10)));
Paragraph elturno = new Paragraph("TURNO",
FontFactory.getFont("arial", // fuente
15));
elturno.setAlignment(Chunk.ALIGN_CENTER);
documento.add(elturno);
Paragraph turnoStr = new Paragraph(turno,
FontFactory.getFont("arial", // fuente
30));
turnoStr.setAlignment(Chunk.ALIGN_CENTER);
documento.add(turnoStr);
Paragraph lafecha = new Paragraph(""+fecha,
FontFactory.getFont("arial", // fuente
10));
lafecha.setAlignment(Chunk.ALIGN_CENTER);
documento.add(lafecha);
documento.close();
try {
e.printStackTrace();
}
if (inputStream == null) {
return "1";
}
DocFlavor docFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
Doc document = new SimpleDoc(inputStream, docFormat, null);
PrintRequestAttributeSet attributeSet = new HashPrintRequestAttributeSet();
PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
if (defaultPrintService != null) {
DocPrintJob printJob = defaultPrintService.createPrintJob();
try {
printJob.print(document, attributeSet);
e.printStackTrace();
}
} else {
System.
err.
println("No existen impresoras instaladas"); }
inputStream.close();
return "ok";
}
Corre perfectamente en Linux y me imprime éste recibo

Al intentar imprimirlo en Windows me aparece el pdf en plano, ósea, ésto
Código:
%PDF-1.4
%����1 0 obj
<</ColorSpace/DeviceGray/Subtype/Image/Height 25/Filter/FlateDecode/Type/XObject/Width 65/Length 892/BitsPerComponent 8>>stream
x��T^MHUg^X~<���j&f �˲ٚ�4+^?���^U�4+B��Eݚ՚4^VښҚ0�(Ś^R)b�V�ǚ&kX��b6^ÚZn^Y1^W��՚^\���S�^E�ݿg�9 {5�^F�^^8�{ �}��� �}^_�YnCk�ů˯�09�"-&��6>گ< �o?m&:�i�D�ʯ#�ͯF�۴2aɴ'^CB$
/��ث[M�,�
Me podrían explicar qué se debe agregar para que funcione en Windows.
Gracias