Gotenberg icon

Gotenberg

Convert documents and manipulate PDFs using Gotenberg (Chromium, LibreOffice, PDF Engines)

Chromium → HTML to Screenshot

AI-generated

Summary

Convert an HTML binary file to PDF or take a screenshot of an HTML binary file

Inputs

  • binaryPropertyName (required) — Name of the binary property containing the input HTML file
  • outputBinaryPropertyName — Name of the binary property to store the output file
  • outputFilename — Filename for the output file (including extension)
  • chromiumOptions — Chromium Options (paper size, margins, scale, format, etc.)

Output shape

A single binary item containing the output file, accompanied by a JSON record with filename and mimeType

The binary is written to the property named in outputBinaryPropertyName; if outputFilename is omitted the default 'output.pdf' is used. Errors are propagated unless continueOnFail is enabled.

Examples

Example 1: Convert an HTML file to PDF

binaryPropertyName=data, operation=htmlToPdf, outputBinaryPropertyName=data, outputFilename=output.pdf, chromiumOptions={paperWidth=8.5,paperHeight=11,marginTop=0.39,marginBottom=0.39,marginLeft=0.39,marginRight=0.39,scale=1,printBackground=false}

Example 2: Take a screenshot of a URL

url=https://example.com, binaryPropertyName=data, operation=htmlScreenshot, outputBinaryPropertyName=screenshot, outputFilename=screenshot.png, chromiumOptions={width=800,height=600,format=png,quality=100}

Example 3: Convert HTML to PDF/A-2b with custom margins

binaryPropertyName=data, operation=htmlToPdf, outputFilename=report.pdf, chromiumOptions={marginTop=0.5,marginBottom=0.5,pdfa=PDF/A-2b}

Links

Discussion