Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
d168695
feat: add agent-pdf Rust microservice
bendersej Mar 19, 2026
050dec3
fix: review fixes for agent-pdf
bendersej Mar 19, 2026
40ef5ef
chore: switch agent-pdf region from ams3 to nyc3
bendersej Mar 19, 2026
40c3b53
feat: add SKILL.md, companyIdentifier query param, and root skill end…
bendersej Mar 19, 2026
01177d4
fix: address code review findings
bendersej Mar 19, 2026
6d88d16
chore: drop /agents slug, use root path for GET and POST
bendersej Mar 19, 2026
e85f6de
feat: review fixes, GET-based URL API, CI workflow
bendersej Mar 19, 2026
8286549
fix: remove unsupported operations from SKILL.md
bendersej Mar 19, 2026
827e0de
fix: clarify companyIdentifier must be a valid SimplePDF identifier
bendersej Mar 19, 2026
df200e0
docs: improve SKILL.md with presentation guidance and portal features
bendersej Mar 19, 2026
3f00fb3
docs: rewrite SKILL.md with direct URL construction and multi-languag…
bendersej Mar 19, 2026
f2c8f08
docs: add React integration example to SKILL.md
bendersej Mar 19, 2026
3574fc6
docs: remove embed.simplepdf.com references, agent.simplepdf.com is t…
bendersej Mar 19, 2026
f6e3c4d
docs: add legal disclaimer to SKILL.md
bendersej Mar 19, 2026
4d507fc
chore: remove id field from API response
bendersej Mar 19, 2026
24c37c9
docs: add automatic form field detection to supported operations
bendersej Mar 19, 2026
c5dca08
fix: switch from buildpack to Dockerfile for DO App Platform
bendersej Mar 19, 2026
b82c08e
fix: add POST JSON path for sensitive URLs, secure proxy trust, unify…
bendersej Mar 19, 2026
206fcac
feat: unify default editor host to ai.simplepdf.com
bendersej Mar 19, 2026
af63719
chore: rename id variable to company_identifier for clarity
bendersej Mar 19, 2026
296db84
docs: rename Portal features to SimplePDF account features, add brand…
bendersej Mar 19, 2026
e39375f
fix: pin builder to rust:1-bookworm to match runtime glibc
bendersej Mar 19, 2026
e298c06
fix: add behavior_version_latest to S3 config, rename env vars to S3_*
bendersej Mar 19, 2026
2c6df2e
docs: rewrite README for quick start and deploy reference
bendersej Mar 19, 2026
5657cef
docs: simplify README to skill install + quick start
bendersej Mar 19, 2026
e74c123
fix: make all env vars required, no defaults
bendersej Mar 19, 2026
b6320d0
docs: simplify install to one-liner fetch
bendersej Mar 19, 2026
3fff912
docs: rename skill to edit-pdf, one-liner install
bendersej Mar 19, 2026
2ded4af
docs: use curl --create-dirs for cleaner install one-liner
bendersej Mar 19, 2026
8c6e3be
chore: rename agent-pdf/ to agents/ for discoverability
bendersej Mar 19, 2026
80a9ea7
docs: bump file expiry to 24h, clarify tab stays open indefinitely
bendersej Mar 19, 2026
ec73cb1
docs: add open source mention with GitHub link
bendersej Mar 19, 2026
bd2cc37
docs: rename domain to agents.simplepdf.com for consistency with fold…
bendersej Mar 19, 2026
0c8339c
feat: serve README at root, SKILL.md at /SKILL.md
bendersej Mar 19, 2026
3746445
docs: move source code link to README, remove from SKILL.md
bendersej Mar 19, 2026
df70cec
docs: rename Install to Add the edit-pdf skill
bendersej Mar 19, 2026
9d43399
docs: remove automatic form field detection from supported operations
bendersej Mar 19, 2026
8bab5cd
feat: switch to presigned URLs, remove public-read ACL
bendersej Mar 19, 2026
3038784
feat: preserve original filename with short hash suffix on upload
bendersej Mar 19, 2026
1454465
feat: add hourly background cleanup of expired uploads (>24h)
bendersej Mar 19, 2026
5c1fd97
feat: replace hourly cleanup cron with S3 lifecycle policy set at sta…
bendersej Mar 19, 2026
ca5e7da
fix: configurable trusted IP header (do-connecting-ip), reject http:/…
bendersej Mar 19, 2026
5ab91fc
fix: replace CREATE_FIELD with DETECT_FIELDS across embed artifacts
bendersej Mar 20, 2026
254530c
chore: add changeset for minor release (createField -> detectFields)
bendersej Mar 20, 2026
cdb0428
chore: bump changeset to major release
bendersej Mar 20, 2026
0fbf4eb
chore: add safe upgrade note to changeset
bendersej Mar 20, 2026
fce12e7
chore: add migration snippet to changeset
bendersej Mar 20, 2026
d48f7a0
chore: merge main into branch, resolve agents/ conflicts
bendersej Mar 20, 2026
92d9d3e
chore: simplify automation to accept document URL/path inline
bendersej Mar 20, 2026
c0d66b3
fix: load local files via LOAD_DOCUMENT data URL instead of invalid l…
bendersej Mar 20, 2026
3b1e84e
fix: use loadingPlaceholder for local files, remove EDITOR_READY wait
bendersej Mar 20, 2026
9cc2065
fix: wait for EDITOR_READY before sending LOAD_DOCUMENT for local files
bendersej Mar 20, 2026
51c8444
feat: log detected field count from DETECT_FIELDS response
bendersej Mar 20, 2026
d429a60
chore: fix prettier formatting in hook.test.ts
bendersej Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .changeset/replace-create-field-with-detect-fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@simplepdf/react-embed-pdf": major
---

Replaces `createField` with `detectFields` for automatic form field detection. This is a breaking change: the `createField` action and `CreateFieldOptions` type have been removed.

If you are not using `actions.createField(...)` or `sendEvent("CREATE_FIELD", ...)`, you can safely update to this new major version.

```ts
// Before (removed)
await actions.createField({ type: "TEXT", page: 1, x: 100, y: 700, width: 200, height: 30 });

// After
await actions.detectFields();
```
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ SimplePDF Embed uses a **fully client-side architecture** for PDF processing:

| Limitation | Description | Workaround |
| --------------------------------- | ----------------------------------------------- | ---------------------------------------------------------- |
| **No server-side PDF generation** | Cannot generate PDFs from templates server-side | Use client-side field creation via `createField()` |
| **No server-side PDF generation** | Cannot generate PDFs from templates server-side | Use client-side field detection via `detectFields()` |
| **No bulk processing** | Cannot process multiple PDFs in batch | Process sequentially or use dedicated server-side library |
| **No programmatic PDF retrieval** | Cannot get modified PDF as Blob/Base64 in JS | Use webhooks + server storage for programmatic access |
| **No persistent storage** | PDFs don't persist without user action | Use `companyIdentifier` for server-side submission storage |
Expand Down Expand Up @@ -285,7 +285,7 @@ Currently, page manipulation (add/remove/re-arrange/rotate) is only available th
| ---------------------- | ---------------------------------------------------------------------------------------------------------- |
| `goTo` | Navigate to a specific page |
| `selectTool` | Select a tool (`TEXT`, `BOXED_TEXT`, `CHECKBOX`, `PICTURE`, `SIGNATURE`) or `null` for cursor |
| `createField` | Create a field at a specified position |
| `detectFields` | Automatically detect form fields in the document |
| `removeFields` | Remove fields by ID, by page, or all fields |
| `getDocumentContent` | Extract text content from the document |
| `submit` | Submit the document (with optional device download) |
Expand Down
41 changes: 5 additions & 36 deletions documentation/IFRAME.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,8 @@ await sendEvent("GO_TO", { page: 3 });
// Select a tool
await sendEvent("SELECT_TOOL", { tool: "TEXT" }); // or "CHECKBOX", "SIGNATURE", "PICTURE", "BOXED_TEXT", null

// Create a field
await sendEvent("CREATE_FIELD", {
type: "TEXT",
page: 1,
x: 100,
y: 700,
width: 200,
height: 30,
value: "Hello World",
});
// Detect fields in the document
await sendEvent("DETECT_FIELDS", {});

// Remove all fields (or specific ones)
await sendEvent("REMOVE_FIELDS", {}); // Remove all
Expand Down Expand Up @@ -290,34 +282,11 @@ Select a drawing tool or return to cursor mode.
| ------ | ---------------- | -------- | ---------------------------------------------------------------------------------------- |
| `tool` | `string \| null` | Yes | `"TEXT"`, `"BOXED_TEXT"`, `"CHECKBOX"`, `"SIGNATURE"`, `"PICTURE"`, or `null` for cursor |

#### CREATE_FIELD

Create a new field on the document.
#### DETECT_FIELDS

| Field | Type | Required | Description |
| -------- | -------- | -------- | --------------------------------------------------------------------- |
| `type` | `string` | Yes | `"TEXT"`, `"BOXED_TEXT"`, `"CHECKBOX"`, `"SIGNATURE"`, or `"PICTURE"` |
| `page` | `number` | Yes | Page number (1-indexed) |
| `x` | `number` | Yes | X coordinate (PDF points from left) |
| `y` | `number` | Yes | Y coordinate (PDF points from bottom) |
| `width` | `number` | Yes | Field width in PDF points |
| `height` | `number` | Yes | Field height in PDF points |
| `value` | `string` | No | Initial value (see value formats below) |
Automatically detect form fields in the document.

**Value formats by field type:**

- `TEXT` / `BOXED_TEXT`: Plain text content
- `CHECKBOX`: `"checked"` or `"unchecked"`
- `PICTURE`: Data URL (base64)
- `SIGNATURE`: Data URL (base64 image) or plain text (generates a typed signature)

**Response data:**

```json
{
"field_id": "f_kj8n2hd9x3m1p"
}
```
_No data fields required._

#### REMOVE_FIELDS

Expand Down
236 changes: 12 additions & 224 deletions examples/with-playwright-automation/README.md
Original file line number Diff line number Diff line change
@@ -1,244 +1,33 @@
# SimplePDF Editor Automation

Playwright-based CLI tool for programmatically creating and positioning fields in PDF documents using the SimplePDF editor.

## Features

- Create TEXT, BOXED_TEXT, CHECKBOX, SIGNATURE, and PICTURE fields
- Position fields using PDF standard coordinates (bottom-left origin)
- Pre-fill field values including typed signatures
- Browser opens for visual inspection after field creation
Playwright-based CLI tool for automatically detecting form fields in PDF documents using the SimplePDF editor.

## Quick Start

```bash
npm install
npx tsx src/index.ts example.config.json
npx tsx src/index.ts https://example.com/form.pdf
```

## Usage

```bash
npx tsx src/index.ts <config.json> [options]
npx tsx src/index.ts <document> [options]

Arguments:
document URL or local file path to a PDF

Options:
--company-identifier Your SimplePDF company identifier (default: embed)
--help Show help
```

### Using Your Company Identifier
### Examples

```bash
npx tsx src/index.ts config.json --company-identifier mycompany
```

This connects to `https://mycompany.simplepdf.com`.

## Configuration

Create a JSON configuration file:

```json
{
"document": "https://example.com/document.pdf",
"fields": [...]
}
```

### Document Source

| Format | Example |
|--------|---------|
| URL | `"https://example.com/doc.pdf"` |
| Local file | `"./documents/form.pdf"` |

## Field Types

### TEXT

Single-line text input.

```json
{
"type": "TEXT",
"x": 100,
"y": 700,
"width": 200,
"height": 20,
"page": 1,
"value": "John Doe"
}
```

### BOXED_TEXT

Multi-line text with border.

```json
{
"type": "BOXED_TEXT",
"x": 100,
"y": 600,
"width": 300,
"height": 100,
"page": 1,
"value": "Additional notes here..."
}
```

### CHECKBOX

Checkable box. Must be square (equal width/height).

```json
{
"type": "CHECKBOX",
"x": 100,
"y": 550,
"width": 12,
"height": 12,
"page": 1,
"value": true
}
```

### SIGNATURE

Signature field with multiple value formats.

```json
{
"type": "SIGNATURE",
"x": 100,
"y": 450,
"width": 200,
"height": 60,
"page": 1,
"value": "John Doe"
}
```

**Value formats:**

| Format | Example | Result |
|--------|---------|--------|
| Plain text | `"John Doe"` | Typed signature (cursive font) |
| URL | `"https://example.com/sig.png"` | Drawn signature from image |
| Data URL | `"data:image/png;base64,..."` | Drawn signature from base64 |
| Local file | `"./signatures/john.png"` | Drawn signature from file |

### PICTURE

Image field.

```json
{
"type": "PICTURE",
"x": 100,
"y": 300,
"width": 150,
"height": 150,
"page": 1,
"value": "https://example.com/photo.jpg"
}
```

**Value formats:** URL, data URL, or local file path.

## Coordinate System

Uses PDF standard coordinates:

```
┌─────────────────────────────┐
│ │ ↑
│ │ │
│ PDF Page │ │ Y increases
│ │ │
│ │ │
└─────────────────────────────┘
(0,0) ───────────────────────→
X increases
```

- **Origin**: Bottom-left corner of page
- **Units**: Points (1/72 inch)
- **Y-axis**: Increases upward

## Examples

### Basic Form Fill

```json
{
"document": "https://cdn.simplepdf.com/simple-pdf/assets/sample.pdf",
"fields": [
{
"type": "TEXT",
"x": 72,
"y": 700,
"width": 200,
"height": 14,
"page": 1,
"value": "John"
},
{
"type": "TEXT",
"x": 320,
"y": 700,
"width": 200,
"height": 14,
"page": 1,
"value": "Doe"
},
{
"type": "SIGNATURE",
"x": 72,
"y": 100,
"width": 200,
"height": 60,
"page": 1,
"value": "John Doe"
}
]
}
```

### Multi-Page Document

```json
{
"document": "./documents/multi-page.pdf",
"fields": [
{
"type": "TEXT",
"x": 72,
"y": 700,
"width": 200,
"height": 14,
"page": 1,
"value": "Page 1 content"
},
{
"type": "TEXT",
"x": 72,
"y": 700,
"width": 200,
"height": 14,
"page": 2,
"value": "Page 2 content"
},
{
"type": "SIGNATURE",
"x": 72,
"y": 100,
"width": 200,
"height": 60,
"page": 3,
"value": "Final Signature"
}
]
}
npx tsx src/index.ts https://example.com/form.pdf
npx tsx src/index.ts ./documents/form.pdf
npx tsx src/index.ts https://example.com/form.pdf --company-identifier mycompany
```

## How It Works
Expand All @@ -247,9 +36,8 @@ The tool uses the SimplePDF editor's iframe postMessage API:

1. Embeds the editor in an iframe
2. Waits for `DOCUMENT_LOADED` event
3. Sends `REMOVE_FIELDS` to remove existing fields
4. Sends `CREATE_FIELD` for each configured field
5. Leaves browser open for inspection
3. Sends `DETECT_FIELDS` to automatically detect form fields
4. Leaves browser open for inspection

## Requirements

Expand Down
Loading
Loading