1. 渲染百度首页为PDF

请求参数:

  1. curl --request POST 'localhost:8084/rest/pdf/render' \
  2. --header 'Content-Type: application/json' \
  3. -d '{
  4. "output": "tmp/",
  5. "fileName": "baidu",
  6. "url": "http://www.baidu.com",
  7. "outputType": "PDF",
  8. "pdf": {
  9. "pageRanges": "1",
  10. "landscape": true,
  11. "printBackground": true,
  12. "preferCSSPageSize": false
  13. }
  14. }'

返回结果:

  1. {
  2. "content": "/Users/program/tal/h5-transfer-pdf/tmp/baidu.pdf",
  3. "status": true,
  4. "message": "render PDF success"
  5. }

2. 渲染并打开PDF

请求参数:

  1. http://localhost:8084/rest/pdf/show?outputType=PDF&output=tmp/&fileName=test&url=http://open.jiaoyanyun.com/#/

返回结果:
image.png