Print gif using java on a 4x6" paper
Posted
by Wienczny
on Stack Overflow
See other posts from Stack Overflow
or by Wienczny
Published on 2009-08-17T22:53:36Z
Indexed on
2010/05/11
12:04 UTC
Read the original article
Hit count: 484
What is the best way in Java to print a gif given as byte[]
or ByteArrayInputStream
on a paper with a size of 4x6 inches?
This:
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(new MediaSize(4, 6, Size2DSyntax.INCH));
aset.add(new Copies(1));
PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.GIF, aset);
DocPrintJob printJob = pservices[0].createPrintJob();
Doc doc = new SimpleDoc(sap.getGraphicImageBytes(), DocFlavor.INPUT_STREAM.GIF, null);
printJob.print(doc, aset);
does not work because the MediaSize is not a PrintRequestAttribute. This should be almost the same as in Package javax.print Description
© Stack Overflow or respective owner