Java - how to print the PDF to a specific printer?

后端 未结 1 879
一向
一向 2021-01-21 02:56

I have 5 printers in Windows 8.1 and the PDF file is not in local system its generated in PHP server.

Question. how can i get the PDF file from the server and print to a

1条回答
  •  孤城傲影
    2021-01-21 03:25

    This gives you back a list of available printers:

    PrintService[] services = PrinterJob.lookupPrintServices();
    

    You can loop through this array and select the printer by name (services[i].getName())

    0 讨论(0)
提交回复
热议问题