/pdf

Service that converts HTML documents to PDF

Primary LanguagePHP

HTML to PDF converter

API

Resource Description
GET /status Get service status
GET /pdf/batch/render/:id Render batch content (deprecated)
POST /pdf/render Render PDF
POST /pdf/batch/add Add content to batch
POST /pdf/batch/render Render batch content
curl -X GET 'http://example.com/status'
OK

Top

!! Deprecated. Use POST /pdf/batch/render instead !!!

curl -X GET 'http://example.com/pdf/batch/render/1354353464'
PDF CONTENT

Top

Required params:

  • content - HTML code

Optional params:

  • page_size (A0, A1, A2, A3, A4, A5, A6)
  • orientation (Portrait, Landscape)
  • page_width (mm)
  • page_height (mm)
  • margin_left (mm)
  • margin_right (mm)
  • margin_top (mm)
  • margin_bottom (mm)
curl --header 'Content-type: application/json' -X POST 'http://example.com/pdf/render' --data-binary '...'
{
  "content": "<b>hello</b>",
  "page_size": "A4",
  "orientation": "Portrait",
  "margin_left": "20mm"
}

Result

PDF CONTENT

Top

Required params:

  • content - HTML code

Optional params:

  • transaction_id - batch ID, you'll receive it on first request and should use it with next requests.
curl --header 'Content-type: application/json' -X POST 'http://example.com/pdf/batch/add' '...'
{
  "content": "<b>hello</b>"
}

Result

[111222333444]

Top

Required params:

  • transaction_id - batch ID

Optional params:

  • page_size (A4, A5, A6)
  • orientation (Portrait, Landscape)
  • page_width (mm)
  • page_height (mm)
  • margin_left (mm)
  • margin_right (mm)
  • margin_top (mm)
  • margin_bottom (mm)
curl --header 'Content-type: application/json' -X POST 'http://example.com/pdf/batch/render' --data-binary '...'
{
  "transaction_id": "111222333444",
  "page_size": "A4",
  "orientation": "Portrait"
}

Result

PDF CONTENT

Top