pdfobject-vue
Advanced tools
Comparing version
@@ -20,3 +20,3 @@ import { ref as r, onMounted as c, onUpdated as p, openBlock as i, createElementBlock as l } from "vue"; | ||
install(e) { | ||
e.component("PDFObject", s); | ||
e.component("PdfObject", s); | ||
} | ||
@@ -23,0 +23,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t(require("vue"),require("pdfobject")):typeof define=="function"&&define.amd?define(["vue","pdfobject"],t):(e=typeof globalThis<"u"?globalThis:e||self,e.PDFObjectVuePlugin=t(e.Vue,e.PDFObject))})(this,function(e,t){"use strict";const r={__name:"PDFObject",props:{url:{type:String,required:!0},options:{type:Object,required:!1}},setup(n){const o=n,i=e.ref(null),u=()=>{t.embed(o.url,i.value,o.options)};return e.onMounted(u),e.onUpdated(u),(p,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"pdfContainer",ref:i},null,512))}};return{install(n){n.component("PDFObject",r)}}}); | ||
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t(require("vue"),require("pdfobject")):typeof define=="function"&&define.amd?define(["vue","pdfobject"],t):(e=typeof globalThis<"u"?globalThis:e||self,e.PDFObjectVuePlugin=t(e.Vue,e.PDFObject))})(this,function(e,t){"use strict";const r={__name:"PDFObject",props:{url:{type:String,required:!0},options:{type:Object,required:!1}},setup(n){const o=n,i=e.ref(null),u=()=>{t.embed(o.url,i.value,o.options)};return e.onMounted(u),e.onUpdated(u),(d,p)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"pdfContainer",ref:i},null,512))}};return{install(n){n.component("PdfObject",r)}}}); |
{ | ||
"name": "pdfobject-vue", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Official PDFObject component for Vue 3", | ||
@@ -29,4 +29,4 @@ "license": "MIT", | ||
"vue": "^3.0.0", | ||
"pdfobject": "^2.2.11" | ||
"pdfobject": "^2.2.12" | ||
} | ||
} |
# pdfobject-vue | ||
A PDFObject component for Vue 3 projects | ||
Creates a `<PDFObject>` Vue component, enabling easy PDF embedding in any Vue 3 project. Pass the URL of the PDF via the `url` parameter (String), and any desired options via the `:options` (Object). Note the binding via colon `:options`. | ||
Creates a `<PdfObject>` Vue component, enabling easy PDF embedding in any Vue 3 project. Pass the URL of the PDF via the `url` parameter (String), and any desired options via the `:options` (Object). Note the binding via colon `:options`. | ||
**Important:** While PDFObject has always been spelled with capitalized PDF (because it's an acronym), the Vue component uses camelCase `PdfObject`. This is to align with Vue's naming convention which stipulates component names should be comprised of two words. | ||
It's safe to use either `<PdfObject>` or `<pdf-object>`. | ||
A full list of PDFObject options (and examples) can be found at [PDFObject.com](https://pdfobject.com). | ||
Assumes PDFObject has also been installed via NPM. `npm install pdfobject` | ||
Assumes the PDFObject JS utility has also been installed via NPM. `npm install pdfobject` | ||
@@ -14,3 +18,3 @@ ## Example | ||
``` | ||
<PDFObject url="/pdf/sample.pdf" :options="{ height: '500px', pdfOpenParams: { view: 'FitV' }}" /> | ||
<PdfObject url="/pdf/sample.pdf" :options="{ height: '500px', pdfOpenParams: { view: 'FitV' }}" /> | ||
``` | ||
@@ -22,6 +26,6 @@ | ||
import App from './App.vue'; | ||
import PDFObjectVuePlugin from 'pdfobject-plugin'; | ||
import PDFObjectPlugin from 'pdfobject-vue'; | ||
const app = createApp(App); | ||
app.use(PDFObjectVuePlugin); | ||
app.use(PDFObjectPlugin); | ||
app.mount('#app'); | ||
@@ -28,0 +32,0 @@ ``` |
@@ -5,3 +5,3 @@ import PDFObjectComponent from './components/PDFObject.vue'; | ||
install(app) { | ||
app.component('PDFObject', PDFObjectComponent); | ||
app.component('PdfObject', PDFObjectComponent); | ||
} | ||
@@ -8,0 +8,0 @@ }; |
5106
6.84%40
11.11%