使用 Launch4j 创建 Jar 和 exe 后,Java 打印作业不打印任何内容

问题描述

Java 打印作业在 eclipse 中工作,但是当我们将应用程序转换为 exe 时,除 PrintJob 外,一切正常。有人可以支持我吗? 注意:使用 Windows 7

public static void print() {

        PdfDocument pdf = new PdfDocument();
        pdf.loadFromFile("C:\\Mayura\\KFF Titrator Report.pdf");

        PrinterJob loPrinterJob = PrinterJob.getPrinterJob();
        PageFormat loPageFormat  = loPrinterJob.defaultPage();
        Paper loPaper = loPageFormat.getPaper();

        //remove the default printing margins
        loPaper.setimageableArea(0,loPageFormat.getWidth(),loPageFormat.getHeight());

        loPageFormat.setPaper(loPaper);
        loPrinterJob.setPrintable(pdf,loPageFormat);

        //display the print dialog
        if (loPrinterJob.printDialog()) {
            try {
                loPrinterJob.print();
            } catch (PrinterException e) {
                e.printstacktrace();
            }
        }
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)