Comparing version 3.1.0 to 3.1.1
{ | ||
"name": "vue-pdf", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "vue.js pdf viewer", | ||
@@ -5,0 +5,0 @@ "main": "src/pdf.vue", |
@@ -27,3 +27,3 @@ # vue-pdf | ||
[vue-pdf demo on jsfiddle](https://jsfiddle.net/9zm9c1sf/24/) | ||
[vue-pdf demo on jsfiddle](https://jsfiddle.net/fossfiddler/5k4ptmqg/145/) | ||
@@ -80,15 +80,10 @@ ## Browser support | ||
#### createLoadingTask(src) | ||
* `src`: see :src prop | ||
This function creates a PDFJS loading task that can be used and reused as :src property. | ||
* `src`: see `:src` prop | ||
This function creates a PDFJS loading task that can be used and reused as `:src` property. | ||
The loading task is a promise that resolves with the PDFJS pdf document that exposes the `numPages` property (see example below). | ||
##### example | ||
``` | ||
<template> | ||
<button @click="$refs.myPdfComponent.print()">print</button> | ||
<pdf ref="myPdfComponent" src="https://cdn.mozilla.net/pdfjs/tracemonkey.pdf"></pdf> | ||
</template> | ||
``` | ||
## Examples | ||
##### example - current page / page count | ||
##### Example - current page / page count | ||
``` | ||
@@ -125,7 +120,14 @@ <template> | ||
##### example - display multiple pages of the same pdf document | ||
##### Example - display multiple pages of the same pdf document | ||
``` | ||
<template> | ||
<div> | ||
<pdf v-for="i in 4" :key="i" :src="pdfSrc" :page="i"></pdf> | ||
v-for="i in numPages" | ||
:key="i" | ||
:src="src" | ||
:page="i" | ||
style="display: inline-block; width: 25%" | ||
></pdf> | ||
</div> | ||
@@ -138,2 +140,4 @@ </template> | ||
var loadingTask = pdf.createLoadingTask('https://cdn.mozilla.net/pdfjs/tracemonkey.pdf'); | ||
export default { | ||
@@ -145,4 +149,12 @@ components: { | ||
return { | ||
pdfSrc: pdf.createLoadingTask('https://cdn.mozilla.net/pdfjs/tracemonkey.pdf') | ||
src: loadingTask, | ||
numPages: undefined, | ||
} | ||
}, | ||
mounted() { | ||
this.src.then(pdf => { | ||
this.numPages = pdf.numPages; | ||
}); | ||
} | ||
@@ -155,5 +167,14 @@ } | ||
##### example - print multiple pages | ||
##### Example - print all pages | ||
``` | ||
<template> | ||
<button @click="$refs.myPdfComponent.print()">print</button> | ||
<pdf ref="myPdfComponent" src="https://cdn.mozilla.net/pdfjs/tracemonkey.pdf"></pdf> | ||
</template> | ||
``` | ||
##### Example - print multiple pages | ||
``` | ||
<template> | ||
<button @click="$refs.myPdfComponent.print(100, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])">print</button> | ||
@@ -209,3 +230,3 @@ <pdf ref="myPdfComponent" src="https://cdn.mozilla.net/pdfjs/tracemonkey.pdf"></pdf> | ||
## Example - complete | ||
##### Example - complete | ||
``` | ||
@@ -212,0 +233,0 @@ <template> |
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
22828
284