Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@certifaction/vue-pdf-viewer
Advanced tools
PDF-Viewer for Vue.js based on Mozillas PDF.js
npm install @certifaction/vue-pdf-viewer
# or if using yarn
yarn add @certifaction/vue-pdf-viewer
import PDFViewer from '@certifaction/vue-pdf-viewer'
new Vue({
components: {
PDFViewer
}
})
Example code how to load the component translations:
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
})
$pdf-viewer-asset-base-path: "/node_modules/@certifaction/pdfjs/dist/";
@import "@certifaction/vue-pdf-viewer/src/style/index";
Type: string
| Required: false
(either pdfjsWorkerSrc
or pdfjsWorkerInstance
is required)
URL to the pdfjs.worker.js or pdfjs.worker.min.js.
Type: Worker
| Required: false
(either pdfjsWorkerInstance
or pdfjsWorkerSrc
is required)
When the worker is loaded with the Webpack worker-loader, you can also pass the instance of the worker.
vue.config.js example:
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:
<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>
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:
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
})
}
Type: string
or Uint8Array
| Required: true
The URL of the PDF document as string
or the PDF documents content as Uint8Array
which should be displayed.
Type: string
or number
| Required: false
| Default: 'auto'
The PDF Viewer renders the pages initially with the defined defaulScale.
Possible number
values: Min = 0.1
, Max = 10
Possible string
values: 'auto'
, 'page-actual',
'page-fit'
, 'page-width'
Type: string
| Required: false
| Default: 'pdf-viewer-document.pdf'
The documentName is used for downloadable files.
Type: boolean
| Required: false
| Default: false
Shows the document download button if true
Type: Object
| Required: false
| Default: {}
These options are passed to the constructor of PDFViewer. Possible options are the PDFViewerOptions from https://github.com/mozilla/pdf.js/web/base_viewer.js.
container
and eventBus
are always overridden by the component.
Released by Certifaction AG
FAQs
PDF-Viewer for Vue.js based on Mozillas PDF.js
The npm package @certifaction/vue-pdf-viewer receives a total of 10 weekly downloads. As such, @certifaction/vue-pdf-viewer popularity was classified as not popular.
We found that @certifaction/vue-pdf-viewer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.