不预览直连打印插件
积木报表自动打印插件使用说明 版本支持version 1.7.5+ date 20240416
概述
目前打印报表需要先通过浏览器预览页面后才能打印,通过此接口可以实现静默打印,不需要提前预览报表。
前置条件
- 客户端支持的操作系统:
1. windows 8+ x86_64
2. Mac Os arm64 & x64
3. Centos 7.9
- 客户端电脑需要提前设置好打印机并将打印机设置为默认打印机
- windows系统下需要安装
Adobe Reader
并将pdf的默认应用程序设置成Adobe Reader
- 客户端电脑安装谷歌浏览器(linux安装google-chrome和chromedriver)
使用方式
1、下载与客户端系统匹配的插件程序
通过 购买一年许可 ,获取积木打印插件
2、运行积木打印插件
启动命令
运行与当前系统匹配的应用程序
./jimu-auto-printer-macos-arm64
当出现下面提示时,代表打印程序已经准备就绪
*INFO: Started server process [52132]INFO: Waiting for application startup.INFO: Application startup complete.INFO: Uvicorn running on http://0.0.0.0:16065 (Press CTRL+C to quit)
> 本插件需要占用系统16065端口.*
3、调用接口
请求示例:
curl --location 'http://<domain>/export/report' \
--header 'Tenantid: null' \
--header 'X-Tenant-Id: null' \
--header 'Content-Type: application/json' \
--data-raw '{
"export_type": "PDF",
"report_ids": [
"???","???"
],
"report_params": [
{
"id": "???",
"params": {
"???": "???"
},
"export_type": "excel"
}
],
"jimu_view_url":"http://<JimuReport-Domain>/jmreport/view/",
"token": "???"
"print_report": true
}'
请求参数说明:
参数 | 类型 | 描述 | 必填 | 示例/说明 |
---|---|---|---|---|
export_type | String | 导出类型 | 必填 | PDF/Excel 二选一,如果需要打印固定为PDF |
report_ids | List<String> | 报表id | report_params 二选一必填 | ["123123123","123123123"] |
report_params | Array | 报表查询参数集合 | report_ids 二选一必填 | [{"id":"123","params":{"name":"张三"}}] |
└ id | String | 报表id | 必填 | "123" |
└ params | Map | 查询参数 | 选填 | {"name":"张三"} |
└ export_type | String | 导出类型 | 选填 | PDF/Excel 二选一 ,优先使用该选项 |
jimu_view_url | String | 积木报表预览页面基础地址 | 必填 | "http://<JimuReport-Domain>/jmreport/view/" |
token | String | 当前用户Token | 非必填 | - |
printReport | bool | 是否打印 | 必填 | true |
响应示例:
{
"success": true,
"message": "导出成功",
"result": {
"report_count": 1,
"downloaded_count": 1,
"failure_rids": [],
"download_path": "/opt/xxx/17116260945c6xOm",
"batch_no": "17116260945c6xOm"
}
}
响应参数说明:
参数 | 类型 | 描述 | 示例/说明 |
---|---|---|---|
report_count | int | 报表总数 | - |
downloaded_count | int | 下载成功总数 | - |
failure_rids | Array | 失败报表id集合 | ["123123123","123123123"] |
download_path | string | 存储路径 | "/opt/xxx/17116260945c6xOm" |
batch_no | string | 批次号 | - |
测试效果
提示
软件运行时会自动下载与当前电脑上安装的chrome
对应版本的chrome-driver
,若出现网络原因导致的无法下载, 请手动下载驱动并放到程序运行目录下的drivers
目录下.
115及以下版本:https://registry.npmmirror.com/binary.html?path=chromedriver
115以上版本:https://googlechromelabs.github.io/chrome-for-testing/