/pdf-renderer

A micro-service that takes HTML content, and returns a PDF document

Primary LanguageGo

PDF Renderer

A micro-service for generating PDF documents

Endpoints

Render HTML

/api/render_html

Request

{
    "htmlBody": <string>,
    "dpi": <int>,
    "pageWidth": <int>,
    "pageHeight": <int>,
    "pageSize": <string>,
    "orientation": <string>,
    "marginTop": <int>,
    "marginBottom": <int>,
    "marginLeft": <int>,
    "marginRight": <int>
}

Options

Value Default
htmlBody -
dpi 96
pageWidth 0 (mm)
pageHeight 0 (mm)
pageSize A4
orientation Portrait
marginTop -
marginBottom 10 (mm)
marginLeft 10 (mm)
marginRight -

NOTE: When the page width and page height is specified, the size and orientation is ignored.

Response

{
    "data": <byte-array>
}

Development

Requirements

  • Go v1.14+

Install dependencies

dep ensure