Impression depuis application web
Bonjour,
Voilà je souhaite imprimer une image depuis une application web en java,
j'utilise ce code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new Copies(1));
PrintService pss[] = PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.JPEG, pras);
if (pss.length == 0) {
throw new RuntimeException("No printer services available.");
}
PrintService ps = pss[0];
System.out.println("Printing to " + ps);
DocPrintJob job = ps.createPrintJob();
FileInputStream fin = new FileInputStream(image);
Doc doc = new SimpleDoc(fin, DocFlavor.INPUT_STREAM.JPEG, null);
job.print(doc, pras);
fin.close(); |
Le problème c'est que c'est tout petit et ça me sors une page vide en plus...
Merci de votre aide.