Different type of pdf files are generated using iText on the serverside and send over ResponsOutputStream. On the clientside, the printdialog is shown (at least on most viewer), and the defaultprinter is selected. Some pdfs should be printed on labelprinter, other on a desktopprinter. Is it possible to preselect a different printer when the printdialog shows up?
I've tried this for a desktop java application and it worked, but i'm not able to do this from serverside.
ec.setResponseContentType("application/pdf");
ec.setResponseHeader("Content-Disposition", "attachment; filename="labels.pdf");
outStream = ec.getResponseOutputStream();
writer = PdfWriter.getInstance(document, outStream);
PdfAction action = new PdfAction(PdfAction.PRINTDIALOG);
writer.setOpenAction(action);
same result using this instruction as I doesn't find a solution to preselect specific printer using Javascript
writer.setOpenAction(PdfAction.javaScript("this.print(true);", writer));
the default printer or last used printer is always selected