单/多网页生成PDF(压缩版)
接口描述:
指定服务端对
param
参数中的网页地址按指定quality
进行截图,把图片生成一个PDF文件,并返回文件流
- 服务端使用了 Playwright 的 Page 对象截图功能
- param 参数中的 report_urls 值单个或多个都会返回pdf文件,一个url对应一页pdf内容
接口地址:
请求方式:
- GET
请求参数:
参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 | schema |
---|---|---|---|---|---|
quality | 图片质量 1-100 | query | false | integer(int32) | |
selector | 元素选择器,指定筛选截图区域的元素选择器,默认:.growthMain |
query | false | string | |
pageSize | 生成PDF页面大小,默认:A4 |
query | false | string | |
param | 需要进行截图的网页地址 Base64 | query | false | string |
- 地址示例:
http://192.168.3.100:30813/wkhtmltopdf?quality=100¶m=eyJyZXBvcnRfdXJscyI6WyJodHRwOi8vMTkyLjE2OC4zLjEwMDozMTI1MS9ncm93dGhQcmludC9zaG93cGFnZS5odG1sP3NjaG9vbENvZGU9MTU0NCZncmFkZUNvZGU9MjEmY2xhc3NDb2RlPTIwMjIxNTQ0MTA3MDEmdGVtcGxhdGVJZD0xNjY2MzE4OTczODI0MDI4NjczJnN0dUlkPTMxOTA4MDcxMzI3NDYwNjcmcGFnZUlkPTE2NjYzMTg5NzYxMTQxMTg2NTYiLCJodHRwOi8vMTkyLjE2OC4zLjEwMDozMTI1MS9ncm93dGhQcmludC9zaG93cGFnZS5odG1sP3NjaG9vbENvZGU9MTU0NCZncmFkZUNvZGU9MjEmY2xhc3NDb2RlPTIwMjIxNTQ0MTA3MDEmdGVtcGxhdGVJZD0xNjY2MzE4OTczODI0MDI4NjczJnN0dUlkPTMxOTA4MDcxMzI3NDYwNjcmcGFnZUlkPTE2NjYzMTg5NzYxMTQxMTg2NTciLCJodHRwOi8vMTkyLjE2OC4zLjEwMDozMTI1MS9ncm93dGhQcmludC9zaG93cGFnZS5odG1sP3NjaG9vbENvZGU9MTU0NCZncmFkZUNvZGU9MjEmY2xhc3NDb2RlPTIwMjIxNTQ0MTA3MDEmdGVtcGx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cmcGFnZUlkPTE2NjYzMTg5NzYxMTgzMTI5NjEiLCJodHRwOi8vMTkyLjE2OC4zLjEwMDozMTI1MS9ncm93dGhQcmludC9zaG93cGFnZS5odG1sP3NjaG9vbENvZGU9MTU0NCZncmFkZUNvZGU9MjEmY2xhc3NDb2RlPTIwMjIxNTQ0MTA3MDEmdGVtcGxhdGVJZD0xNjY2MzE4OTczODI0MDI4NjczJnN0dUlkPTMxOTA4MDcxMzI3NDYwNjcmcGFnZUlkPTE2NjYzMTg5NzYxMTgzMTI5NjIiLCJodHRwOi8vMTkyLjE2OC4zLjEwMDozMTI1MS9ncm93dGhQcmludC9zaG93cGFnZS5odG1sP3NjaG9vbENvZGU9MTU0NCZncmFkZUNvZGU9MjEmY2xhc3NDb2RlPTIwMjIxNTQ0MTA3MDEmdGVtcGxhdGVJZD0xNjY2MzE4OTczODI0MDI4NjczJnN0dUlkPTMxOTA4MDcxMzI3NDYwNjcmcGFnZUlkPTE2NjYzMTg5NzYxMTgzMTI5NjMiLCJodHRwOi8vMTkyLjE2OC4zLjEwMDozMTI1MS9ncm93dGhQcmludC9zaG93cGFnZS5odG1sP3NjaG9vbENvZGU9MTU0NCZncmFkZUNvZGU9MjEmY2xhc3NDb2RlPTIwMjIxNTQ0MTA3MDEmdGVtcGxhdGVJZD0xNjY2MzE4OTczODI0MDI4NjczJnN0dUlkPTMxOTA4MDcxMzI3NDYwNjcmcGFnZUlkPTE2NjYzMTg5NzYxMTgzMTI5NjQiXX0=
- param 进行 base64 解码后:
{"report_urls":["http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976114118656","http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976114118657","http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976114118658","http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976114118659","http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976114118660","http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976118312960","http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976118312961","http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976118312962","http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976118312963","http://192.168.3.100:31251/growthPrint/showpage.html?schoolCode=1544&gradeCode=21&classCode=2022154410701&templateId=1666318973824028673&stuId=3190807132746067&pageId=1666318976118312964"]}
- Base64 编码/解码
https://c.runoob.com/front-end/693/
作者:Jeebiz 创建时间:2023-06-09 12:07
最后编辑:Jeebiz 更新时间:2024-03-22 19:10
最后编辑:Jeebiz 更新时间:2024-03-22 19:10