veebiekspert/cloud-print

该软件包的最新版本(v1.0)没有提供许可证信息。

PHP客户端,用于连接HTTP云打印机

v1.0 2022-06-12 10:49 UTC

This package is auto-updated.

Last update: 2024-09-08 21:48:12 UTC


README

通过HTTP请求将PDF文件打印到本地Windows计算机

注册许可证

在网站上注册账户并创建新的10天试用许可证:https://www.e-liides.ee/et/printer

下载.exe文件并设置Windows程序

收到许可证密钥后,将.exe设置安装到连接到打印机的Windows计算机上

现在将许可证密钥插入打开的弹出窗口,并按照以下步骤操作。

将您的Web应用程序与API连接

通过composer安装

composer require veebiekspert/cloud-print

在您的PHP应用程序中使用API

<?php
use Veebiekspert\CloudPrint\Api;

$licenceKey = ''; // replace this with your e-liides licence key

$pdfPath = ''; // path where pdf file exists
$pdfFileSource = file_get_contents($pdfPath);

$cloudPrinter = new Api($licenceKey);

$printers = [];
foreach ($cloudPrinter->getPrinters() as $printer) {
    $printers[] = [
        'printer_id' => $printer['printer_id'],
        'name' => $printer['name'],
    ];
}

// Get first printer if exists
if (!empty($printers)) {
    $printer = array_shift($printers);
    $cloudPrinter->addJob($pdfFileSource, $printer['printer_id']);
    
    // up to 10 seconds and windows device starts printing
}

成功打印的重要注意事项

  1. Windows机器必须运行
  2. 已安装的.exe应用程序必须运行,默认情况下,重启后会自动启动
  3. Windows机器上已安装Java

Swagger文档

https://e-liides.ee/api/documentation#/Cloud%20Print