Skip to content

SDK Overview

The Glyph SDK provides a drop-in web component for document editing and PDF generation. It handles the UI, API communication, and PDF download - you just provide the data.

<script src="https://sdk.glyph.you/glyph.min.js"></script>
Terminal window
npm install @glyphpdf/sdk
import '@glyphpdf/sdk';
// or import specific components
import { GlyphEditor, GlyphAPI } from '@glyphpdf/sdk';
ComponentDescription
<glyph-editor>Full document editor with preview, AI editing, and PDF download
GlyphPreviewPreview-only component (no editing)
GlyphChatAI chat interface component
ClassDescription
GlyphAPISimplified API client for editor workflow
GlyphApiClientFull-featured API client
createApiClient()Factory function for API client
<!DOCTYPE html>
<html>
<head>
<script src="https://sdk.glyph.you/glyph.min.js"></script>
</head>
<body>
<glyph-editor
api-key="gk_your_api_key"
template="quote-modern"
data='{"client": {"name": "John"}, "lineItems": [], "totals": {"subtotal": 0, "total": 0}}'
></glyph-editor>
</body>
</html>
┌─────────────────────────────────────────┐
│ <glyph-editor> │
│ ┌─────────────────────────────────┐ │
│ │ Document Preview │ │
│ │ (iframe with HTML content) │ │
│ └─────────────────────────────────┘ │
│ ┌─────────────────────────────────┐ │
│ │ Quick Action Pills │ │
│ │ [Add logo] [Colors] [Pro] ... │ │
│ └─────────────────────────────────┘ │
│ ┌──────────────────────┐ ┌──────────┐ │
│ │ Command Input │ │ Download │ │
│ └──────────────────────┘ └──────────┘ │
└─────────────────────────────────────────┘
│ │
▼ ▼
GlyphAPI GlyphAPI
.modify() .generate()
│ │
▼ ▼
┌────────────────────────────────┐
│ Glyph API │
│ POST /v1/modify │
│ POST /v1/generate │
└────────────────────────────────┘

The component uses Shadow DOM for style encapsulation, ensuring it doesn’t conflict with your page styles.

Click on document sections (header, line items, totals, etc.) to target AI modifications to that specific region.

Pre-built modification buttons for common changes:

  • Add logo
  • Brand colors
  • More professional
  • Emphasize totals
  • Compact layout

Type any natural language instruction in the command input to modify the document.

See changes instantly as they’re applied, before downloading the final PDF.

The SDK includes TypeScript definitions. For framework-specific type support:

types/glyph.d.ts
declare namespace JSX {
interface IntrinsicElements {
'glyph-editor': React.DetailedHTMLProps<
React.HTMLAttributes<HTMLElement> & {
'api-key': string;
template?: string;
data?: string;
theme?: string;
'api-url'?: string;
},
HTMLElement
>;
}
}
BrowserMinimum Version
Chrome90+
Firefox90+
Safari14+
Edge90+