Media

PDF Embed Plugin

PDF Embed Plugin

Embed PDFs via <iframe> with a resizable container.

  • Hotkey: Ctrl+Alt+P
  • Toolbar: button with 📄 icon

Installation

npm install on-codemerge

Basic Usage

import { Editor, PDFEmbedPlugin } from 'on-codemerge';

const editor = new Editor(container, {
  plugins: [PDFEmbedPlugin()],
});

How It Works

  1. Click the toolbar button or press the hotkey to open the popup
  2. Enter the PDF URL and dimensions → Insert
  3. A .pdf-embed-container with an <iframe> and a resize handle is inserted

Tip: try https://example.com/sample.pdf and resize the container.

Programmatic Example

Demo

Public API (v2)

Factory: PDFEmbedPlugin().

Command
insertPdfeditor.command('insertPdf')

Keyboard shortcuts

ShortcutCommand
Mod-Alt-pinsertPdf

Note: Command insertPdf — no triggerEvent('pdf-embed').