Servlet / jsp print dialog
I want to display a print dialog in servlet / jsp. Below is my code:
DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet () ;
PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
PrintService service = javax.print.ServiceUI.printDialog(null, 200, 200, printService, defaultService, flavor, pras);
if (service != null)
{
DocPrintJob job = service.createPrintJob();
Doc doc = new SimpleDoc(decodedImageData, flavor, null);
job.print(doc, null);
}
It works well in a standalone application. However, I am unable to display the print dialog in servlet / jsp.
0
Dell
source
to share