Generate PDF Skill (HTML/Markdown)

Generate PDF Skill (HTML/Markdown)

Overview

Use the Generate PDF skill to turn agent-authored HTML or Markdown into a PDF. The output is always a PDF and can be attached to a Salesforce record when a recordId is provided in the request.

Who This Is For

Salesforce Administrators who configure iDialogue agents that need to deliver PDF documents (summaries, proposals, NDAs, invoices, and similar).

Requirements

  • Agent model must be GPT-5 (custom tools). GPT-4.1 is not supported for this tool.
  • Agent must have the Generate PDF skill enabled (primitive generate_pdf with custom tool input).
  • Provide a recordId in the /ai/response request when you want the PDF attached.

Input Rules

  • Tool input is raw HTML or raw Markdown only. Do not wrap it in JSON.
  • HTML is preferred for precision. Markdown is supported only when it is clearly detectable (headings, lists, tables, code fences).
  • If content is ambiguous, it is treated as HTML.

Filename Rules

The filename is derived in this order:

  1. <meta name="pdf-filename" content="your-file.pdf">
  2. <title> tag
  3. First <h1> (or first Markdown heading)

The filename is sanitized, capped at 120 characters, and always ends in .pdf.

Rendering Notes (HTML)

The PDF renderer supports OpenHTMLtoPDF with CSS 2.1 plus common CSS3 extensions.

  • Use @page for size and margins.
  • Use page-break-before / page-break-after where you need explicit page breaks.
  • Prefer PNG/JPG images over HTTPS; SVG may not render reliably.

Attachment Behavior

  • If recordId is present, the PDF is attached to that Salesforce record as a File (new version on re-run).
  • If recordId is missing, no attachment occurs; the response includes a download link only.

Admin Setup Checklist

  1. Add the Generate PDF skill to the agent (primitive generate_pdf, custom tool input).
  2. Set the agent model to GPT-5.
  3. Add prompt guidance so the agent sends raw HTML or Markdown only.
  4. Confirm users have permission to create Files on the target object.

Prompt Guidance Snippet

Use this in your system or skill prompt to steer agent output:

When the user requests a PDF, call generate_pdf with raw HTML only (no JSON).
Include <meta name="pdf-filename" content="..."> in the <head>.
If you choose Markdown, start with a heading and include clear Markdown syntax
so the format can be detected reliably.

Examples

HTML Example

<html>
  <head>
    <meta name="pdf-filename" content="nda-summary.pdf">
    <style>@page { size: letter; margin: 1in; }</style>
    <title>NDA Summary</title>
  </head>
  <body>
    <h1>NDA Summary</h1>
    <p>One paragraph summary of the agreement.</p>
  </body>
</html>

Markdown Example

# NDA Summary

## Parties
- ACME Corp
- TEST INC

## Terms
| Term | Value |
| --- | --- |
| Term Length | 2 years |

Troubleshooting

  • Invalid value: 'custom': the agent is not using GPT-5; update the model.
  • No attachment: missing recordId or insufficient Salesforce file permissions.
  • Filename not applied: include the pdf-filename meta tag or a top-level heading.
  • Images missing: use HTTPS PNG/JPG links; avoid SVG.

<Token usage: total=1,156,127 input=1,036,360 (+ 8,541,696 cached) output=119,767 (reasoning 98,880) To continue this session, run codex resume 019bd78b-9380-7a93-836f-c8869c24d630

Generated 2026-03-17T05:03:49.110162Z
iDialogue Agent

Ask about this page, related knowledge or specific iDialogue product and support features.