Gotenberg icon

Gotenberg

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

Chromium → HTML to PDF

AI-generated

Summary

Convert an HTML binary file to PDF using Chromium

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)
  • paperWidth — Paper width in inches (default: 8.5)
  • paperHeight — Paper height in inches (default: 11)
  • landscape — Whether to use landscape orientation
  • marginTop — Top margin in inches (default: 0.39)
  • marginBottom — Bottom margin in inches (default: 0.39)
  • marginLeft — Left margin in inches (default: 0.39)
  • marginRight — Right margin in inches (default: 0.39)
  • scale — Scale factor for page rendering (0.1‑2.0)
  • printBackground — Whether to print background graphics
  • waitDelay — Duration to wait before converting (e.g., "1s", "500ms")
  • waitForExpression — JavaScript expression that must return true before conversion proceeds
  • extraHttpHeaders — Additional HTTP headers as a JSON object (used for URL conversions)
  • pdfa — Target PDF/A conversion format (e.g., PDF/A-1a, PDF/A-2b, PDF/A-3b)
  • pdfua — Enable PDF/UA (Universal Accessibility) format
  • width — Viewport width for screenshot (pixels)
  • height — Viewport height for screenshot in pixels (0 = full page height)
  • format — Image format for screenshots (png, jpeg, webp)
  • quality — Compression quality for JPEG/WebP screenshots (0–100)
  • clip — Whether to clip the screenshot to the viewport size

Output shape

Binary PDF file plus JSON metadata containing filename and mimeType

The PDF binary is placed in the property named by outputBinaryPropertyName; the JSON payload includes filename and mimeType fields.

Examples

Example 1: Basic HTML-to-PDF conversion

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

Example 2: PDF/A-2b conversion with custom margins

binaryPropertyName=data, outputBinaryPropertyName=pdfData, outputFilename=report.pdf, chromiumOptions: {paperWidth:8.5,paperHeight:11,landscape:true,marginTop:0.5,marginBottom:0.5,marginLeft:0.5,marginRight:0.5,scale:1,printBackground:true,pdfa:PDF/A-2b}

Links

Discussion