使用sendToPrinter API

概述

在AEM Forms中,您可以使用SendToPrinter服务将文档发送到打印机。 SendToPrinter服务支持以下打印访问机制:

  • 可直接访问的打印机 : A printer that is installed on the same computer is called a direct accessible printer, and the computer is named printer host. This type of printer can be a local printer that is connected to the computer directly.

  • 间接可访问的打印机 : The printer that is installed on a print server is accessed from other computers. Technologies such as the common UNIX® printing system (CUPS) and the Line Printer Daemon (LPD) protocol are available to connect to a network printer. To access an indirect accessible printer, specify the print server’s IP or host name. Using this mechanism, you can send a document to an LPD URI when the network has an LPD running. The mechanism lets you route the document to any printer that is connected to the network that has an LPD running.

    将文档发送到打印机时,请指定以下打印协议之一:

    • CUPS : A printing protocol named common UNIX printing system. This protocol is used for UNIX operating systems and enables a computer to function as a print server. The print server accepts print requests from client applications, processes them, and sends them to configured printers. On the IBM AIX® operating system, usage of CUPS is not recommended.
    • DirectIP : A standard protocol for remote printing and managing print jobs. This protocol can be used locally or remotely. Print queues are not required.
    • LPD : A printing protocol named Line Printer Daemon protocol or Line Printer Remote (LPR) protocol. This protocol provides network print server functionality for UNIX-based systems.
    • 共享打印机 : A printing protocol that enables a computer to use a printer that is configured for that computer.
    • CIFS:输出服务支持通用Internet文件系统(CIFS)打印协议。

使用SendToPrinter服务

下表列出了:

  • 有关用于各种协议的printerName或printServer的信息。
  • 打印机返回打印机服务器URI和打印机名称的各种组合的值或异常
协议(访问机制) 打印服务器URI (PrinterSpec.printServer) 打印机的名称(PrinterSpec.printerName) 结果
SharedPrinter 任意 异常:必需的参数sPrinterName不能为空。
SharedPrinter 任意 无效 出现异常,指出找不到打印机。
SharedPrinter 任意 有效 打印作业成功。
LPD 任意 出现异常,指示所需的参数sPrintServerUri不能为空。
LPD 无效 出现异常,指示所需的参数sPrinterName不能为空。
LPD 无效 不为空 异常,表明未找到sPrintServerUri。
LPD 有效 无效 出现异常,说明找不到打印机。
LPD 有效 有效 成功的打印作业。
CUP 任意 出现异常,指示所需的参数sPrintServerUri不能为空。
CUP 无效 任意 出现异常,说明找不到打印机。
CUP 有效 任意 打印作业成功。
DirectIP 任意 出现异常,指示所需的参数sPrintServerUri不能为空。
DirectIP 无效 任意 出现异常,说明找不到打印机。
DirectIP 有效 任意 打印作业成功。
CIFS 有效 打印作业成功。
CIFS 无效 任意 使用CIFS打印时出现未知错误。
CIFS 任意 出现异常,指示所需的参数sPrintServerUri不能为空。

身份验证支持

只有CIFS打印支持身份验证。 若要进行身份验证,请在PrinterSpec中提供用户名/密码/域。 可以通过执行以下步骤来使用AEM Granite CyprtoSupport Service加密口令:

  1. 转到https://<server>:<port>/system/console。

  2. 转到 主要 > 加密支持.

  3. 输入一些纯文本,然后单击 Protect.

在此页面上