pdfobject-vue is an official Vue 3 component designed to facilitate the embedding of PDF documents directly into Vue applications. It serves as a declarative and reactive wrapper for the underlying PDFObject JavaScript utility. Currently at version 0.0.5, this package offers a `<PdfObject>` component that accepts a PDF `url` and `options` (matching the core PDFObject API) as props, simplifying what would otherwise be direct DOM manipulation. As a relatively new and early-stage project, its release cadence is currently irregular, but it benefits from leveraging the mature PDFObject library itself. A key differentiator is its status as the official Vue 3 integration, ensuring compatibility and adherence to best practices for both libraries. It aims to provide a seamless, idiomatic Vue experience for PDF embedding, handling the complexities of the underlying utility.
npm install pdfobject-vueVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to register pdfobject-vue globally in `main.ts` and then use the `<PdfObject>` component in a Vue single-file component (`.vue` file) with props for the PDF URL and advanced options. It provides a complete, runnable example, including basic styling.
Ensure `pdfobject` is installed alongside `pdfobject-vue`: `npm install pdfobject vue pdfobject-vue`.
Always refer to the component as `PdfObject` (e.g., `<PdfObject />` in templates or `import { PdfObject } from 'pdfobject-vue'`).For production deployments, consider pinning to exact versions (e.g., `"pdfobject-vue": "0.0.5"`) or thoroughly test any updates before integration.
Always bind the `options` prop: `<PdfObject :url="pdfUrl" :options="{ height: '500px' }" />`.If using in standalone mode, use `<pdf-object>`. For build mode, `<PdfObject>` is generally preferred for consistency with Vue best practices.
Run `npm install pdfobject` in your project's root directory.
Ensure the component is used as `<PdfObject />` in your templates and imported as `import { PdfObject } from 'pdfobject-vue';`.Use `:options` (shorthand for `v-bind:options`) when passing an object: `<PdfObject :options="{ height: '500px' }" />`.Ensure your project is using Vue 3 (`npm install vue@next` for the latest Vue 3) and resolve any dependency conflicts by updating or manually adjusting versions if necessary.