Windows 10中未返回默认打印机 [英] Default printer is not returned in windows 10

查看:354
本文介绍了Windows 10中未返回默认打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将Windows环境从8更新为10,并发现默认打印机未返回,而是返回另一台打印机。

I have updated my windows environment from 8 to 10 and found that the default printer is not being returned and a different one is returned instead.

我已关闭让Windows管理我的默认打印机设置,但仍然没有获得默认打印机。

I have turned off the "Let windows manage my default printer" setting, but still not getting the default printer.

我有以下代码:

 private void testPrinter() {
    PrintService[] array = PrintServiceLookup.lookupPrintServices(null, null);
    for(PrintService ps : array){
        System.out.println(ps.getName());
    }

}

在这个测试中,我得到了一个打印机列表如下:

In this test, I get a list of printers as following:


  • 发送到一个备注

  • Send to one note

Microsoft XPS文档编写器

Microsoft XPS Document Writer

HP打印机

Epson打印机(这是在Windows中设置为我的默认打印机)

Epson Printer (which is set as my default printer in windows)

但是,在以下测试中:

 PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
 System.out.println(ps.getName());

我得到惠普打印机,这不是我的默认打印机!无论我选择哪台打印机作为默认打印机,HP打印机都会一直返回

I get the HP printer, which is not my default printer!!! No matter which printer I chose as a default, the HP printer is returned always

我通过了java API查找了lookupDefaultPrintService方法,并说明了以下内容:

I went through the java API for lookupDefaultPrintService method and it says the following:


找到此环境的默认打印服务。这可能是
返回null。如果多个查找服务都指定了默认值,则未精确定义
选择的服务,但平台本机
服务(而不是已安装的服务)通常作为
默认值返回。如果没有明确可识别的平台本机默认
打印服务,则默认是第一个以
依赖于实现的方式定位。

Locates the default print service for this environment. This may return null. If multiple lookup services each specify a default, the chosen service is not precisely defined, but a platform native service, rather than an installed service, is usually returned as the default. If there is no clearly identifiable platform native default print service, the default is the first to be located in an implementation-dependent manner.

这可能包括使用
可用的任何首选项API作为Java或本机平台的一部分。设置属性javax.print.defaultPrinter的用户可以覆盖此算法

必须发现指定的服务有效且当前
可作为默认值返回。

This may include making use of any preferences API that is available as part of the Java or native platform. This algorithm may be overridden by a user setting the property javax.print.defaultPrinter. A service specified must be discovered to be valid and currently available to be returned as the default.

在Windows 8中,返回默认打印机没有问题。更新后我遇到了这个问题。我该如何解决这个问题?

In windows 8, there was no issue with returning the default printer. After updating I'm getting this problem. How can I solve this issue?

推荐答案

正如指南,Windows 10每次打印时重新配置默认打印机,设置默认为最后使用的设备。您必须更改此设置。

As pointed out in this guide, Windows 10 reconfigure your default printer each time you print, setting the default as the last used device. You have to change this setting.

编辑:您还可以尝试通过注册表(regedit.exe)直接禁用该功能,搜索所有 LegacyDefaultPrinterMode DWORD 实例并将它们设置为1(关闭)。通常主要实例在这里:

You can also try to directly disable the feature via registry (regedit.exe), searching for all LegacyDefaultPrinterMode DWORD instances and setting them to 1 (off). Usually the main instance is here:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows

这篇关于Windows 10中未返回默认打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆