@certifaction/vue-pdf-viewer
Advanced tools
Comparing version 0.0.15 to 1.0.0
/*! | ||
* @certifaction/vue-pdf-viewer 0.0.14 | ||
* @certifaction/vue-pdf-viewer 0.0.15 | ||
* | ||
@@ -207,6 +207,2 @@ * @link https://certifaction.com | ||
props: { | ||
url: { | ||
type: String, | ||
required: true | ||
}, | ||
pdfjsWorkerSrc: { | ||
@@ -223,2 +219,6 @@ type: String, | ||
required: true | ||
}, | ||
url: { | ||
type: String, | ||
required: true | ||
} | ||
@@ -324,3 +324,3 @@ }, | ||
/* template */ | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"pdf-viewer"},[_c('div',{ref:"viewerContainer",staticClass:"viewer-container"},[_c('div',{staticClass:"viewer"})]),_vm._v(" "),_c('div',{staticClass:"controls"},[_c('div',{staticClass:"pages"},[_vm._v("\n "+_vm._s(_vm._$t('pdfViewer.page'))+"\n "),_c('span',{staticClass:"current"},[_vm._v(_vm._s(_vm.currentPage))]),_vm._v(" / "),_c('span',{staticClass:"total"},[_vm._v(_vm._s(_vm.pageCount))])]),_vm._v(" "),_c('div',{staticClass:"scale"},[_c('button',{staticClass:"btn secondary",attrs:{"type":"button"},on:{"click":_vm.decreaseScale}},[_c('MDIcon',{attrs:{"icon":_vm.mdiMinus}})],1),_vm._v(" "),_c('button',{staticClass:"btn secondary",attrs:{"type":"button"},on:{"click":_vm.increaseScale}},[_c('MDIcon',{attrs:{"icon":_vm.mdiPlus}})],1),_vm._v(" "),_c('select',{directives:[{name:"model",rawName:"v-model",value:(_vm.currentScale),expression:"currentScale"}],staticClass:"scale-selector",on:{"change":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return val}); _vm.currentScale=$event.target.multiple ? $$selectedVal : $$selectedVal[0];}}},[_vm._l((_vm.scaleOptions),function(option){return _c('option',{key:option.value,domProps:{"value":option.value}},[_vm._v(_vm._s(option.label)+"\n ")])}),_vm._v(" "),_c('option',{staticClass:"hidden",attrs:{"disabled":""},domProps:{"value":_vm.customScale.value}},[_vm._v(_vm._s(_vm.customScale.label))])],2)])])])}; | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"pdf-viewer"},[_c('div',{ref:"viewerContainer",staticClass:"viewer-container"},[_c('div',{staticClass:"viewer"})]),_vm._v(" "),_c('div',{staticClass:"controls"},[_c('div',{staticClass:"pages"},[_vm._v("\n "+_vm._s(_vm._$t('pdfViewer.page'))+"\n "),_c('span',{staticClass:"current"},[_vm._v(_vm._s(_vm.currentPage))]),_vm._v(" / "),_c('span',{staticClass:"total"},[_vm._v(_vm._s(_vm.pageCount))])]),_vm._v(" "),_c('div',{staticClass:"scale"},[_c('button',{staticClass:"btn",attrs:{"type":"button"},on:{"click":_vm.decreaseScale}},[_c('MDIcon',{attrs:{"icon":_vm.mdiMinus}})],1),_vm._v(" "),_c('button',{staticClass:"btn",attrs:{"type":"button"},on:{"click":_vm.increaseScale}},[_c('MDIcon',{attrs:{"icon":_vm.mdiPlus}})],1),_vm._v(" "),_c('select',{directives:[{name:"model",rawName:"v-model",value:(_vm.currentScale),expression:"currentScale"}],staticClass:"scale-selector",on:{"change":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return val}); _vm.currentScale=$event.target.multiple ? $$selectedVal : $$selectedVal[0];}}},[_vm._l((_vm.scaleOptions),function(option){return _c('option',{key:option.value,domProps:{"value":option.value}},[_vm._v(_vm._s(option.label)+"\n ")])}),_vm._v(" "),_c('option',{staticClass:"hidden",attrs:{"disabled":""},domProps:{"value":_vm.customScale.value}},[_vm._v(_vm._s(_vm.customScale.label))])],2)])])])}; | ||
var __vue_staticRenderFns__ = []; | ||
@@ -327,0 +327,0 @@ |
/*! | ||
* @certifaction/vue-pdf-viewer 0.0.14 | ||
* @certifaction/vue-pdf-viewer 0.0.15 | ||
* | ||
@@ -203,6 +203,2 @@ * @link https://certifaction.com | ||
props: { | ||
url: { | ||
type: String, | ||
required: true | ||
}, | ||
pdfjsWorkerSrc: { | ||
@@ -219,2 +215,6 @@ type: String, | ||
required: true | ||
}, | ||
url: { | ||
type: String, | ||
required: true | ||
} | ||
@@ -320,3 +320,3 @@ }, | ||
/* template */ | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"pdf-viewer"},[_c('div',{ref:"viewerContainer",staticClass:"viewer-container"},[_c('div',{staticClass:"viewer"})]),_vm._v(" "),_c('div',{staticClass:"controls"},[_c('div',{staticClass:"pages"},[_vm._v("\n "+_vm._s(_vm._$t('pdfViewer.page'))+"\n "),_c('span',{staticClass:"current"},[_vm._v(_vm._s(_vm.currentPage))]),_vm._v(" / "),_c('span',{staticClass:"total"},[_vm._v(_vm._s(_vm.pageCount))])]),_vm._v(" "),_c('div',{staticClass:"scale"},[_c('button',{staticClass:"btn secondary",attrs:{"type":"button"},on:{"click":_vm.decreaseScale}},[_c('MDIcon',{attrs:{"icon":_vm.mdiMinus}})],1),_vm._v(" "),_c('button',{staticClass:"btn secondary",attrs:{"type":"button"},on:{"click":_vm.increaseScale}},[_c('MDIcon',{attrs:{"icon":_vm.mdiPlus}})],1),_vm._v(" "),_c('select',{directives:[{name:"model",rawName:"v-model",value:(_vm.currentScale),expression:"currentScale"}],staticClass:"scale-selector",on:{"change":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return val}); _vm.currentScale=$event.target.multiple ? $$selectedVal : $$selectedVal[0];}}},[_vm._l((_vm.scaleOptions),function(option){return _c('option',{key:option.value,domProps:{"value":option.value}},[_vm._v(_vm._s(option.label)+"\n ")])}),_vm._v(" "),_c('option',{staticClass:"hidden",attrs:{"disabled":""},domProps:{"value":_vm.customScale.value}},[_vm._v(_vm._s(_vm.customScale.label))])],2)])])])}; | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"pdf-viewer"},[_c('div',{ref:"viewerContainer",staticClass:"viewer-container"},[_c('div',{staticClass:"viewer"})]),_vm._v(" "),_c('div',{staticClass:"controls"},[_c('div',{staticClass:"pages"},[_vm._v("\n "+_vm._s(_vm._$t('pdfViewer.page'))+"\n "),_c('span',{staticClass:"current"},[_vm._v(_vm._s(_vm.currentPage))]),_vm._v(" / "),_c('span',{staticClass:"total"},[_vm._v(_vm._s(_vm.pageCount))])]),_vm._v(" "),_c('div',{staticClass:"scale"},[_c('button',{staticClass:"btn",attrs:{"type":"button"},on:{"click":_vm.decreaseScale}},[_c('MDIcon',{attrs:{"icon":_vm.mdiMinus}})],1),_vm._v(" "),_c('button',{staticClass:"btn",attrs:{"type":"button"},on:{"click":_vm.increaseScale}},[_c('MDIcon',{attrs:{"icon":_vm.mdiPlus}})],1),_vm._v(" "),_c('select',{directives:[{name:"model",rawName:"v-model",value:(_vm.currentScale),expression:"currentScale"}],staticClass:"scale-selector",on:{"change":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return val}); _vm.currentScale=$event.target.multiple ? $$selectedVal : $$selectedVal[0];}}},[_vm._l((_vm.scaleOptions),function(option){return _c('option',{key:option.value,domProps:{"value":option.value}},[_vm._v(_vm._s(option.label)+"\n ")])}),_vm._v(" "),_c('option',{staticClass:"hidden",attrs:{"disabled":""},domProps:{"value":_vm.customScale.value}},[_vm._v(_vm._s(_vm.customScale.label))])],2)])])])}; | ||
var __vue_staticRenderFns__ = []; | ||
@@ -323,0 +323,0 @@ |
{ | ||
"name": "@certifaction/vue-pdf-viewer", | ||
"version": "0.0.15", | ||
"version": "1.0.0", | ||
"description": "PDF-Viewer for Vue.js based on Mozillas PDF.js", | ||
@@ -31,3 +31,3 @@ "private": false, | ||
"dependencies": { | ||
"@certifaction/pdfjs": "^0.0.15", | ||
"@certifaction/pdfjs": "^1.0.0", | ||
"@mdi/js": "^5.9.55", | ||
@@ -41,10 +41,10 @@ "core-js": "^3.9.1" | ||
"devDependencies": { | ||
"@babel/core": "^7.13.8", | ||
"@babel/preset-env": "^7.13.9", | ||
"@babel/core": "^7.13.10", | ||
"@babel/preset-env": "^7.13.10", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^17.1.0", | ||
"@rollup/plugin-node-resolve": "^11.2.0", | ||
"autoprefixer": "^10.2.4", | ||
"autoprefixer": "^10.2.5", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^7.21.0", | ||
"eslint": "^7.22.0", | ||
"eslint-config-standard": "^16.0.2", | ||
@@ -58,3 +58,3 @@ "eslint-plugin-import": "^2.22.1", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.40.0", | ||
"rollup": "^2.41.4", | ||
"rollup-plugin-vue": "^5.1.9", | ||
@@ -64,3 +64,3 @@ "vue": "^2.6.12", | ||
}, | ||
"gitHead": "e4912eeac73e5ad17e3a9fb7574d35ec3e29176c" | ||
"gitHead": "b3beabda98eb2cb462f060d0114e9359e6dbe425" | ||
} |
168
README.md
# @certifaction/vue-pdf-viewer | ||
[![npm][npm]][npm-url] | ||
[![lerna][lerna]][lerna-url] | ||
PDF-Viewer for Vue.js based on Mozillas PDF.js | ||
## Table of contents | ||
* [Install](#install) | ||
* [As NPM package](#as-npm-package) | ||
* [Usage](#usage) | ||
* [ES6](#es6) | ||
* [Load locales](#load-locales) | ||
* [Load stylesheet](#load-stylesheet) | ||
* [License](#license) | ||
## Install | ||
### As NPM package | ||
```shell script | ||
npm install @certifaction/vue-pdf-viewer | ||
# or if using yarn | ||
yarn add @certifaction/vue-pdf-viewer | ||
``` | ||
## Usage | ||
### ES6 | ||
```js | ||
import PDFViewer from '@certifaction/vue-pdf-viewer' | ||
new Vue({ | ||
components: { | ||
PDFViewer | ||
} | ||
}) | ||
``` | ||
### Load locales | ||
Example code how to load the component translations: | ||
```js | ||
import merge from 'lodash.merge' | ||
import pdfViewerEN from '@certifaction/vue-pdf-viewer/src/locales/en.json' | ||
import pdfViewerDE from '@certifaction/vue-pdf-viewer/src/locales/de.json' | ||
import pdfViewerFR from '@certifaction/vue-pdf-viewer/src/locales/fr.json' | ||
import pdfViewerIT from '@certifaction/vue-pdf-viewer/src/locales/it.json' | ||
function loadLocaleMessages() { | ||
// Load your messages | ||
} | ||
const messages = merge({ | ||
en: pdfViewerEN, | ||
de: pdfViewerDE, | ||
fr: pdfViewerFR, | ||
it: pdfViewerIT | ||
}, loadLocaleMessages()) | ||
new VueI18n({ | ||
messages | ||
}) | ||
``` | ||
### Load stylesheet | ||
```scss | ||
$pdf-viewer-asset-base-path: "/node_modules/@certifaction/pdfjs/dist/"; | ||
@import "@certifaction/vue-pdf-viewer/src/style/index"; | ||
``` | ||
## Props | ||
### pdfjsWorkerSrc | ||
Type: `string` | Required: `false` (either [`pdfjsWorkerSrc`](#pdfjsworkersrc) or [`pdfjsWorkerInstance`](#pdfjsworkerinstance) is required) | ||
URL to the pdfjs.worker.js or pdfjs.worker.min.js. | ||
### pdfjsWorkerInstance | ||
Type: `Worker` | Required: `false` (either [`pdfjsWorkerInstance`](#pdfjsworkerinstance) or [`pdfjsWorkerSrc`](#pdfjsworkersrc) is required) | ||
When the worker is loaded with the Webpack [worker-loader](https://www.npmjs.com/package/worker-loader), you can also pass the instance of the worker. | ||
vue.config.js example: | ||
```js | ||
chainWebpack: config => { | ||
config.module | ||
.rule('js') | ||
.exclude.add(/\.worker\.js$/) | ||
config.module | ||
.rule('worker') | ||
.test(/\.worker(\.min)?\.js$/) | ||
.use('worker-loader') | ||
.loader('worker-loader') | ||
.options({ filename: 'js/[name].[hash:8].js' }) | ||
.end() | ||
} | ||
``` | ||
Usage example: | ||
```vue | ||
<template> | ||
<div class="test"> | ||
<PDFViewer :pdfjs-worker-instance="pdfjsWorker"/> | ||
</div> | ||
</template> | ||
<script> | ||
import PdfjsWorker from '@certifaction/pdfjs/dist/pdfjs.worker.min' | ||
export default { | ||
name: 'Test', | ||
components: { | ||
PDFViewer | ||
}, | ||
data() { | ||
return { | ||
pdfjsWorker: new PdfjsWorker() | ||
} | ||
} | ||
} | ||
</script> | ||
``` | ||
### pdfjsCMapUrl | ||
Type: `string` | Required: `true` | ||
Pass the path where the cmaps can be accessed. | ||
vue.config.js example to copy the cmaps to the dist folder: | ||
```js | ||
chainWebpack: config => { | ||
config.plugin('copy') | ||
.tap(args => { | ||
args[0].push({ | ||
from: '@certifaction/pdfjs/dist/cmaps', | ||
to: 'pdf/cmaps', | ||
toType: 'dir', | ||
context: './node_modules' | ||
}) | ||
return args | ||
}) | ||
} | ||
``` | ||
### url | ||
Type: `string` | Required: `true` | ||
URL of the PDF document which should be displayed. | ||
## License | ||
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/certifaction/js-pdf-viewer/blob/master/LICENSE) | ||
Released by [Certifaction AG](https://certifaction.com) | ||
[npm]: https://img.shields.io/npm/v/@certifaction/vue-pdf-viewer.svg | ||
[npm-url]: https://www.npmjs.com/package/@certifaction/vue-pdf-viewer | ||
[lerna]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg | ||
[lerna-url]: https://lerna.js.org/ |
import './pdf.init' | ||
import { pdfjsViewer } from '@certifaction/pdfjs' | ||
// import pdfjsViewer from '@certifaction/pdfjs/dist/pdf_viewer.js' | ||
// import * as pdfjsViewer from 'pdfjs-dist/web/pdf_viewer' | ||
// console.log(window['pdfjs-dist/build/pdf']) | ||
delete window['pdfjs-dist/build/pdf'] | ||
export default pdfjsViewer |
import { pdfjsLib } from '@certifaction/pdfjs' | ||
// import pdfjsLib from '@certifaction/pdfjs/dist/pdf.js' | ||
// import * as pdfjsLib from 'pdfjs-dist/build/pdf' | ||
window['pdfjs-dist/build/pdf'] = pdfjsLib |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
70217
0
172
720
+ Added@certifaction/pdfjs@1.7.2(transitive)
+ Added@mapbox/node-pre-gyp@1.0.11(transitive)
+ Addedabbrev@1.1.1(transitive)
+ Addedagent-base@6.0.2(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedaproba@2.0.0(transitive)
+ Addedare-we-there-yet@2.0.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcanvas@2.11.2(transitive)
+ Addedchownr@2.0.0(transitive)
+ Addedcolor-support@1.1.3(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconsole-control-strings@1.1.0(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddecompress-response@4.2.1(transitive)
+ Addeddelegates@1.0.0(transitive)
+ Addeddetect-libc@2.0.3(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedfs-minipass@2.1.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedgauge@3.0.2(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhas-unicode@2.0.1(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedmake-dir@3.1.0(transitive)
+ Addedmimic-response@2.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminipass@3.3.65.0.0(transitive)
+ Addedminizlib@2.1.2(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addedms@2.1.3(transitive)
+ Addednan@2.22.0(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addednopt@5.0.0(transitive)
+ Addednpmlog@5.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath2d@0.1.1(transitive)
+ Addedpath2d-polyfill@2.1.1(transitive)
+ Addedpdfjs-dist@3.11.174(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@6.3.17.6.3(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@3.1.1(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedtar@6.2.1(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedwide-align@1.1.5(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedyallist@4.0.0(transitive)
- Removed@certifaction/pdfjs@0.0.15(transitive)
- Removeddommatrix@1.0.3(transitive)
- Removedpdfjs-dist@2.16.105(transitive)
- Removedweb-streams-polyfill@3.3.3(transitive)
Updated@certifaction/pdfjs@^1.0.0