← Back to Documentation

Document Utilities

A comprehensive toolset for AI workers to create, convert, and manage documents without requiring external integrations.

Overview

Document Utilities enable AI workers to generate PDFs, convert images, merge and split documents, and send files via email—all without needing external document processing services.

  • Maximum file size: 50MB per file
  • Supports idempotency to prevent duplicate operations
  • All generated files are stored securely and downloadable from the Files page
  • Email attachments require SMTP email integration

Available Tools

doc.markdownToPdf

Convert Markdown content to a styled PDF document

Use case: Generate reports, documentation, or formatted content from Markdown text

Parameters:

markdown (string)outputFileName (string)pageSize? (A4|Letter|Legal)landscape? (boolean)

doc.htmlToPdf

Convert HTML content with CSS styling to PDF

Use case: Create branded documents, invoices, or styled layouts

Parameters:

html (string)outputFileName (string)pageSize? (A4|Letter|Legal)landscape? (boolean)

doc.textToPdf

Convert plain text to a simple PDF document

Use case: Export logs, notes, or plain text content

Parameters:

text (string)outputFileName (string)pageSize? (A4|Letter|Legal)

doc.renderTemplateToPdf

Render a Handlebars template with data to PDF

Use case: Generate personalized letters, invoices, contracts with variable data

Parameters:

template (string)data (object)outputFileName (string)pageSize?landscape?

doc.imageConvert

Convert images between JPEG, PNG, and WebP formats

Use case: Optimize images for web or convert between formats

Parameters:

sourceFileId (string)targetFormat (jpeg|png|webp)quality? (1-100)outputFileName (string)

doc.imagesToPdf

Combine multiple images into a single PDF

Use case: Create photo albums, image compilations, or scanned document bundles

Parameters:

imageFileIds (string[])outputFileName (string)pageSize?landscape?

doc.mergePdfs

Merge multiple PDF files into one document

Use case: Combine reports, invoices, or documents

Parameters:

pdfFileIds (string[])outputFileName (string)

doc.splitPdf

Extract specific pages from a PDF

Use case: Extract chapters, sections, or specific pages

Parameters:

sourceFileId (string)startPage (number)endPage (number)outputFileName (string)

comms.emailWithAttachments

Send email with file attachments via SMTP

Use case: Send generated documents directly to recipients

Parameters:

to (string)subject (string)body (string)attachmentFileIds (string[])replyTo?

Example: Generate Invoice PDF

{
  "type": "doc.renderTemplateToPdf",
  "template": "<h1>Invoice #{{invoiceNumber}}</h1>
    <p>Bill to: {{customerName}}</p>
    <table>
      <tr><td>{{item}}</td><td>{{amount}}</td></tr>
    </table>
    <p><strong>Total: {{total}}</strong></p>",
  "data": {
    "invoiceNumber": "INV-2024-001",
    "customerName": "Acme Corp",
    "item": "Consulting Services",
    "amount": "$5,000",
    "total": "$5,000"
  },
  "outputFileName": "invoice-2024-001"
}

Viewing Generated Files

All generated files are accessible from two locations:

  • Files page - View all files generated by your organization
  • Task detail view - See files generated during a specific task