Skip to content

Installation

Glyph can be integrated into your project in several ways, depending on your tech stack and preferences.

The simplest way to get started. No build step required:

<script src="https://sdk.glyph.you/glyph.min.js"></script>

This loads the latest stable version and registers the <glyph-editor> web component globally.

For better page performance, load asynchronously:

<script src="https://sdk.glyph.you/glyph.min.js" async></script>

When loading async, wait for the component to be defined:

customElements.whenDefined('glyph-editor').then(() => {
// Safe to use glyph-editor
});

For modern JavaScript projects with a build step:

Terminal window
npm install @glyphpdf/sdk
import { GlyphEditor, GlyphAPI } from '@glyphpdf/sdk';
// The web component is auto-registered
// You can also use the API client directly
const api = new GlyphAPI('gk_your_key_here');
const { GlyphEditor, GlyphAPI } = require('@glyphpdf/sdk');
import '@glyphpdf/sdk';
function QuoteEditor({ quoteData }) {
return (
<glyph-editor
api-key="gk_your_key_here"
template="quote-modern"
data={JSON.stringify(quoteData)}
/>
);
}

For TypeScript, add type declarations:

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
>;
}
}
<template>
<glyph-editor
:api-key="apiKey"
template="quote-modern"
:data="JSON.stringify(quoteData)"
@glyph:ready="onReady"
@glyph:modified="onModified"
/>
</template>
<script setup>
import '@glyphpdf/sdk';
const apiKey = 'gk_your_key_here';
const quoteData = { /* ... */ };
function onReady(event) {
console.log('Editor ready:', event.detail);
}
function onModified(event) {
console.log('Changes:', event.detail.changes);
}
</script>

In vite.config.js, tell Vue about the custom element:

export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => tag === 'glyph-editor'
}
}
})
]
});
<script>
import '@glyphpdf/sdk';
export let quoteData;
function handleReady(event) {
console.log('Ready:', event.detail);
}
</script>
<glyph-editor
api-key="gk_your_key_here"
template="quote-modern"
data={JSON.stringify(quoteData)}
on:glyph:ready={handleReady}
/>

If you don’t need the visual editor, you can use the API directly:

import { GlyphAPI } from '@glyphpdf/sdk';
const api = new GlyphAPI('gk_your_key_here');
// Generate a preview
const { html, sessionId } = await api.preview('quote-modern', quoteData);
// Modify with AI
const { html: modifiedHtml, changes } = await api.modify(
sessionId,
'Make the header navy blue'
);
// Generate PDF
const pdfBlob = await api.generate(sessionId);

For enterprise deployments, you can self-host the Glyph API. Contact support@glyph.you for access to the self-hosted package.

Once you have access, point your SDK to your self-hosted instance:

<glyph-editor
api-key="gk_your_key_here"
api-url="https://your-glyph-api.com"
template="quote-modern"
data='...'
></glyph-editor>
EnvironmentMinimum Version
Node.js18.x (for npm package)
BrowsersChrome 90+, Firefox 90+, Safari 14+, Edge 90+
TypeScript4.7+ (optional)