# Integrate in Web Component

- Human documentation: [https://docs.univer.ai/guides/pdfs/getting-started/integrations/web-component](https://docs.univer.ai/guides/pdfs/getting-started/integrations/web-component)

- Agent Markdown: [https://docs.univer.ai/guides/pdfs/getting-started/integrations/web-component.md](https://docs.univer.ai/guides/pdfs/getting-started/integrations/web-component.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.3`

- Source: [pdfs/getting-started/integrations/web-component.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/pdfs/getting-started/integrations/web-component.mdx)

---

Start with [installation and basic usage](https://docs.univer.ai/guides/pdfs/getting-started/installation.md). This example uses Web Component to mount Univer Pdfs in a container with an explicit height.

### Integration Steps

1. Initialize Univer in `connectedCallback`.
2. Dispose of Univer in `disconnectedCallback`.

### Example

```typescript
import { UniverLicensePlugin } from '@univerjs-pro/license'
import { UniverPdfsPlugin } from '@univerjs-pro/pdfs'
import { UniverPdfsUIPlugin } from '@univerjs-pro/pdfs-ui'
import PdfsUIenUS from '@univerjs-pro/pdfs-ui/locale/en-US'
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'
import { FUniver } from '@univerjs/core/facade'
import DesignenUS from '@univerjs/design/locale/en-US'
import { UniverUIPlugin } from '@univerjs/ui'
import UIenUS from '@univerjs/ui/locale/en-US'

import '@univerjs/design/lib/index.css'
import '@univerjs/ui/lib/index.css'
import '@univerjs-pro/pdfs-ui/lib/index.css'

import '@univerjs-pro/pdfs/facade'

class UniverEditorElement extends HTMLElement {
  private univer?: Univer

  connectedCallback() {
    const container = this

    const univer = new Univer({
      locale: LocaleType.EN_US,
      locales: {
        [LocaleType.EN_US]: mergeLocales(
          DesignenUS,
          UIenUS,
          PdfsUIenUS,
        ),
      },
    })

    univer.registerPlugin(UniverLicensePlugin, {
      license: 'your license.txt',
    })
    univer.registerPlugin(UniverUIPlugin, { container })
    univer.registerPlugin(UniverPdfsPlugin)
    univer.registerPlugin(UniverPdfsUIPlugin)

    const univerAPI = FUniver.newAPI(univer)
    univerAPI.createPdf({ name: 'Untitled PDF' })
    this.univer = univer
  }

  disconnectedCallback() {
    this.univer?.dispose()
    this.univer = undefined
  }
}

customElements.define('univer-pdfs-editor', UniverEditorElement)
```

```html
<univer-pdfs-editor style="display: block; height: 600px"></univer-pdfs-editor>
```
