PDFBox: How to print pdf with specified printer?

后端 未结 5 943
余生分开走
余生分开走 2020-12-14 10:32

I want to use PDFBox for printing PDF files created by iText. I have tried this successfully with PDDocument class and its method print(). You can find docu

5条回答
  •  时光取名叫无心
    2020-12-14 10:56

    PDDocument also offers other print methods than the parameterless print():

    public void print(PrinterJob printJob) throws PrinterException;
    public void silentPrint() throws PrinterException;
    public void silentPrint(PrinterJob printJob) throws PrinterException;
    

    The silentPrint methods don't show the dialog.

    You may get what you want by first selecting a printer and then call silentPrint with PrinterJob instances initialized accordingly.

提交回复
热议问题