Comparing version 3.2.3 to 3.3.0
{ | ||
"name": "vue-pdf", | ||
"version": "3.2.3", | ||
"version": "3.3.0", | ||
"description": "vue.js pdf viewer", | ||
@@ -5,0 +5,0 @@ "main": "src/vuePdfNoSss.vue", |
@@ -69,3 +69,6 @@ # vue-pdf | ||
#### @link-clicked <sup>Number<sup> | ||
Triggered when an internal link is clicked | ||
### Public methods | ||
@@ -239,3 +242,3 @@ | ||
<div v-if="loadedRatio > 0 && loadedRatio < 1" style="background-color: green; color: white; text-align: center" :style="{ width: loadedRatio * 100 + '%' }">{{ Math.floor(loadedRatio * 100) }}%</div> | ||
<pdf v-if="show" ref="pdf" style="border: 1px solid red" :src="src" :page="page" :rotate="rotate" @password="password" @progress="loadedRatio = $event" @error="error" @num-pages="numPages = $event"></pdf> | ||
<pdf v-if="show" ref="pdf" style="border: 1px solid red" :src="src" :page="page" :rotate="rotate" @password="password" @progress="loadedRatio = $event" @error="error" @num-pages="numPages = $event" @link-clicked="page = $event"></pdf> | ||
</div> | ||
@@ -242,0 +245,0 @@ </div> |
import { CMapCompressionType } from 'pdfjs-dist/lib/shared/util'; | ||
import { PDFLinkService } from 'pdfjs-dist/lib/web/pdf_link_service'; | ||
@@ -244,3 +245,13 @@ export default function(PDFJS) { | ||
clearAnnotations(); | ||
var viewer = { | ||
scrollPageIntoView: ({ pageNumber }) => { | ||
emitEvent('link-clicked', pageNumber) | ||
}, | ||
}; | ||
let linkService = new PDFLinkService(); | ||
linkService.setDocument(pdfDoc); | ||
linkService.setViewer(viewer); | ||
pdfPage.getAnnotations() | ||
@@ -254,4 +265,4 @@ .then(function(annotations) { | ||
page: pdfPage, | ||
//linkService: new LinkServiceMock(), | ||
renderInteractiveForms: false, | ||
linkService: linkService, | ||
renderInteractiveForms: false | ||
}); | ||
@@ -258,0 +269,0 @@ }); |
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
27082
506
287