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_pdfwith custom tool input). - Provide a
recordIdin the/ai/responserequest 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:
<meta name="pdf-filename" content="your-file.pdf"><title>tag- 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
@pagefor size and margins. - Use
page-break-before/page-break-afterwhere you need explicit page breaks. - Prefer PNG/JPG images over HTTPS; SVG may not render reliably.
Attachment Behavior
- If
recordIdis present, the PDF is attached to that Salesforce record as a File (new version on re-run). - If
recordIdis missing, no attachment occurs; the response includes a download link only.
Admin Setup Checklist
- Add the Generate PDF skill to the agent (primitive
generate_pdf, custom tool input). - Set the agent model to GPT-5.
- Add prompt guidance so the agent sends raw HTML or Markdown only.
- 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
recordIdor insufficient Salesforce file permissions. - Filename not applied: include the
pdf-filenamemeta 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