Skip to content

PDF Skill

Use this skill when asked to generate PDFs, extract text from PDFs, or fill and flatten PDF forms.

---
name: pdf-skill
description: Create and read PDF documents, and fill PDF forms with companyFILES MCP tools. Use when asked to generate a PDF report, export content as PDF, create a PDF from HTML or Markdown, read or extract text from a PDF, fill a PDF form, or flatten a form for final delivery.
---
# PDF Skill
Tools for creating PDF documents, reading PDF content, and filling/flattening PDF forms.
## Tools in This Skill
| Tool | Purpose |
|------|---------|
| `create_pdf` | Create PDF from Markdown with headers, footers, page numbers |
| `create_pdf_from_html` | Create PDF from HTML with custom CSS |
| `read_pdf` | Extract text and metadata from a PDF |
| `read_pdf_form_fields` | List the fillable fields of **any** uploaded/created PDF (no template needed) |
| `fill_pdf_form_fields` | Fill **any** uploaded/created PDF's fields, saving a new PDF (`flatten` for read-only) |
| `list_pdf_form_templates` | List pre-registered PDF form templates and their fields |
| `fill_pdf_form` | Fill a registered template form — fields remain editable |
| `fill_and_flatten_pdf_form` | Fill and flatten a registered template form (read-only / final) |
## Decision Guide
```
User wants to CREATE a PDF from...
Markdown → create_pdf
HTML / CSS → create_pdf_from_html
User wants to READ a PDF → read_pdf
User wants to FILL a PDF form...
An uploaded/arbitrary PDF (PREFERRED, no registration needed):
1. read_pdf_form_fields (discover exact field names + types)
2. fill_pdf_form_fields (set flatten=true to lock the result)
A pre-registered template form:
1. list_pdf_form_templates (discover available templates + fields)
2. fill_pdf_form (editable) OR fill_and_flatten_pdf_form (locked)
```
## Tool Usage
### create_pdf
```json
{
"markdown": "# Monthly Report\n\n## Executive Summary\n\nThis month we achieved...",
"filename": "monthly_report",
"title": "Monthly Report – May 2025",
"author": "Finance",
"page_size": "A4",
"page_orientation": "portrait",
"header_text": "Confidential",
"footer_text": "Acme Corp",
"show_page_numbers": true,
"page_number_position": "footer",
"page_number_format": "{page} / {pages}",
"folder": "reports"
}
```
### create_pdf_from_html
```json
{
"html": "<h1>Invoice</h1><table>...</table>",
"css": "body { font-family: Arial; } h1 { color: #336699; }",
"filename": "invoice",
"title": "Invoice #1234",
"page_size": "A4",
"show_page_numbers": true,
"folder": "invoices"
}
```
Supports inline images via `doc:<documentId>` (stored doc) or `lc:<file_id>` (LibreChat attachment) URI: `<img src="doc:abc123..." />`. The same applies to Markdown images in `create_pdf`: `![alt](doc:<uuid>)` or `![alt](lc:<file_id>)`.
### read_pdf
```json
{
"file_content": "<base64-encoded pdf>"
}
```
Accepts any one of `file_content` (base64), `librechat_file_id`, or `document_id`. Returns extracted text and metadata.
### read_pdf_form_fields
Inspect the form fields of **any** uploaded or created PDF — no template registration needed. Accepts `document_id` **or** `librechat_file_id`.
```json
{
"document_id": "abc12345-..."
}
```
Returns `{ document_id, filename, fieldCount, fields }`, where each field has `name`, `type` (`text`, `checkbox`, `dropdown`, `radio`), current value, and (for dropdown/radio) `options`. Call this first to get exact field names before filling. (Date fields appear as `text`; signature fields are not listed.)
### fill_pdf_form_fields
Fill the fields of any uploaded/created PDF and save the result as a **new** PDF (the original blank form is preserved). Accepts `document_id` **or** `librechat_file_id`.
```json
{
"document_id": "abc12345-...",
"values": {
"fullName": "Alice Smith",
"agree": true,
"department": "Engineering"
},
"flatten": false,
"filename": "application_alice",
"folder": "applications"
}
```
Values: strings for text/date/dropdown/radio fields, booleans for checkboxes. Set `flatten: true` to make the result read-only.
### list_pdf_form_templates
```json
{}
```
Returns a list of available PDF form templates with field names and types (text, checkbox, radio, dropdown).
### fill_pdf_form
```json
{
"template_name": "application",
"values": {
"fullName": "Alice Smith",
"email": "alice@example.com",
"agree": true,
"department": "Engineering"
},
"filename": "application_alice",
"folder": "applications"
}
```
Fields remain **editable** after filling.
### fill_and_flatten_pdf_form
```json
{
"template_name": "application",
"values": {
"fullName": "Alice Smith",
"agree": true
},
"filename": "application_alice_final",
"folder": "applications"
}
```
Form is **flattened** (read-only) — use for final/archival copies.
## Common Page Options (create tools)
| Parameter | Values | Default |
|-----------|--------|---------|
| `page_size` | `A4`, `Letter`, `Legal`, `A3`, `A5` | `A4` |
| `page_orientation` | `portrait`, `landscape` | `portrait` |
| `page_number_position` | `header`, `footer` | `footer` |
| `page_number_format` | string with `{page}` and `{pages}` | `{page} / {pages}` |
## Key Notes
- All create tools return `{id, filename, downloadUrl, markdownLink}` — always render `markdownLink` in the reply.
- **To fill an arbitrary uploaded PDF**, use `read_pdf_form_fields` + `fill_pdf_form_fields` — no template registration needed. The `*_pdf_form` / `*_form_templates` tools only work with pre-registered templates.
- Pre-registered PDF form templates are managed via the admin API (upload via `POST /api/admin/pdf-forms`).
- When `folder` is omitted on `fill_pdf_form` / `fill_and_flatten_pdf_form`, the output is filed under a folder named after the template.
- Field value types: strings for text/dropdown/radio fields, booleans for checkboxes.
- Org/user color theme is automatically applied when configured.