Orshot Logo
OrshotDocs
Orshot Embed

Vue SDK

Integrate Orshot Embed into your Vue 3 applications

The Vue SDK provides a wrapper component for Vue 3 to easily integrate Orshot Embed into your application.

Installation

npm install @orshot/embed-vue
# or
pnpm add @orshot/embed-vue
# or
yarn add @orshot/embed-vue

Usage

Import the component and usage is similar to any standard Vue component.

<script setup>
import { ref } from "vue";
import { OrshotEmbed } from "@orshot/embed-vue";

const embedRef = ref(null);

const handleCreate = (data) => {
  console.log("Template created", data);
};
</script>

<template>
  <div style="height: 700px">
    <OrshotEmbed
      ref="embedRef"
      embed-id="YOUR_EMBED_ID"
      template-id="TEMPLATE_ID"
      :modifications="{ name: 'John Doe' }"
      @template:create="handleCreate"
      @error="(err) => console.error(err)"
    />
  </div>
</template>

Props

PropTypeDescription
embed-idstringYour Embed configuration ID.
template-idstring | numberID of the template to load initially.
modificationsobjectInitial data to populate the template.
widthstring | numberWidth of the iframe (default: 100%).
heightstring | numberHeight of the iframe (default: 100%).
urlstringOptional custom instance URL.

Events

The component emits standard Orshot events:

  • @template:create
  • @template:update
  • @template:content
  • @download:png
  • @download:pdf
  • @error

See the Events documentation for payload details.

Methods

You can access methods via the component ref:

// Change template
embedRef.value.setTemplate("new-id");

// Update data
embedRef.value.setModifications({ title: "New Title" });

// Request export
embedRef.value.requestContent("png", { scale: 2 });

Source

View on GitHub

On this page