Categories

HTML Mail to PDF

Render email HTML content to PDF with preserved basic formatting using Puppeteer

Render email HTML to PDF with Chromium. **Highlights:** - Supports raw HTML content or uploaded HTML file - Preserves basic mail layout: tables, images, inline styles - Optional message metadata header (subject, from, to, date)

Example Results

2 examples

Newsletter HTML Mail

Render HTML newsletter content to PDF with a mail header

libreoffice-html-mail-to-pdf-example1.pdf View File
View input parameters
{ "mailHtml": "<h2 style='color:#0f172a'>Q1 Product Update</h2><p>Hello team,</p><p>We shipped 3 major features this quarter.</p><table><tr><th>Area</th><th>Status</th></tr><tr><td>Platform</td><td>Stable</td></tr><tr><td>Growth</td><td>+18%</td></tr></table><p>Regards,<br/>Product Ops</p>", "subject": "Quarterly Product Update", "from": "[email protected]", "to": "[email protected]", "date": "2026-02-16 10:00", "pageSize": "A4", "landscape": false, "marginMm": 12 }

Raw Mail HTML on Letter

Convert a full HTML email document to Letter-size PDF

libreoffice-html-mail-to-pdf-example2.pdf View File
View input parameters
{ "mailHtml": "<!doctype html><html><body style='font-family:Arial'><div style='border:1px solid #d1d5db;padding:12px;border-radius:8px'><h3>Support Ticket Reply</h3><p>Hi Alex,</p><p>Your request has been completed. Please review the attached details.</p><ul><li>Ticket: #3241</li><li>Owner: Support Team</li><li>Status: Closed</li></ul><p>Thanks.</p></div></body></html>", "pageSize": "Letter", "landscape": false, "marginMm": 10 }

Click to upload file or drag and drop file here

Maximum file size: 30MB Supported formats: text/html

API Documentation

Request Endpoint

POST /en/api/tools/libreoffice-html-mail-to-pdf

Request Parameters

Parameter Name Type Required Description
mailHtml textarea No -
htmlFile file (Upload required) No -
subject text No -
from text No -
to text No -
date text No -
pageSize select No -
landscape checkbox No -
marginMm number No -

File type parameters need to be uploaded first via POST /upload/libreoffice-html-mail-to-pdf to get filePath, then pass filePath to the corresponding file field.

Response Format

{
  "filePath": "/public/processing/randomid.ext",
  "fileName": "output.ext",
  "contentType": "application/octet-stream",
  "size": 1024,
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
File: File

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-libreoffice-html-mail-to-pdf": {
      "name": "libreoffice-html-mail-to-pdf",
      "description": "Render email HTML content to PDF with preserved basic formatting using Puppeteer",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=libreoffice-html-mail-to-pdf",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

Supports URL file links or Base64 encoding for file parameters.

If you encounter any issues, please contact us at [email protected]