# PrintService **Repository Path**: memory_s/print-service ## Basic Information - **Project Name**: PrintService - **Description**: 支持各类文件打印、获取打印机列表及默认打印机、下载网络文件、PDF 转换图片的应用服务。 采用 HTTP 形式完成操作,exe 后台无感运行为,目前仅支持 Windows 平台。 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2024-11-15 - **Last Updated**: 2025-03-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Print Service #### 介绍 支持各类文件打印、获取打印机列表及默认打印机、下载网络文件、PDF 转换图片的应用服务。 采用 HTTP 形式完成操作,exe 后台无感运行为,目前仅支持 Windows 平台。 #### 软件架构 python、poetry、request、SumatraPDF #### 启动项目 ```sh poetry install poetry shell startup ``` #### 构建项目 ```sh poetry install # 方式1: python setup.py # 方式2: poetry shell build ``` #### 使用说明 1. 执行项目根目录下的: /bundle/PrintFileService.exe 应用程序 2. 此时,系统中会开启一个名为: PrintFileService 的进程 3. 在浏览器中输入: http://127.0.0.1:3688 能看到启动成功的输出,即表示服务开启成功 4. 需要结束此后台服务时,有两种方式: 1. 打开系统任务管理器,找到 PrintFileService 进程结束运行 2. 调用 HTTP 接口的方式通知程序结束运行,可参考以下示例 #### 参与贡献 1. Fork 本仓库 2. 新建 feat/xxx 分支 3. 提交代码 4. 新建 merge request 作者欢迎大家为此服务贡献一份自己的力量 #### 示例 ```python import request # 查看服务是否开启成功,成功后会返回: “printer server listener successfully... ” response = requests.get('http://127.0.0.1:3688') # 查看当前系统的打印机列表:/api/printer ''' { "code":200, "result":[ {"default":false,"printer_name":"OneNote (Desktop)"}, {"default":true,"printer_name":"Microsoft Print to PDF"} ] } ''' response = requests.get('http://127.0.0.1:3688/api/printer') # 查看当前系统的默认打印机:/api/printer/default ''' { "code":200, "result":[ {"default":false,"printer_name":"OneNote (Desktop)"}, {"default":true,"printer_name":"Microsoft Print to PDF"} ] } ''' response = requests.get('http://127.0.0.1:3688/api/printer/default') ```