Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tato30/vue-pdf

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tato30/vue-pdf - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

93

cjs/index.js

@@ -5,7 +5,7 @@ 'use strict';

var PDFJSLib = require('pdfjs-dist/build/pdf');
var pdf_viewer = require('pdfjs-dist/web/pdf_viewer');
require('pdfjs-dist/web/pdf_viewer.css');
var vue = require('vue');
var PDFJSlib = require('pdfjs-dist/build/pdf');
var PDFJSWorker = require('pdfjs-dist/build/pdf.worker.entry');
var pdf_viewer = require('pdfjs-dist/web/pdf_viewer');
require('pdfjs-dist/web/pdf_viewer.css');

@@ -32,42 +32,5 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var PDFJSlib__namespace = /*#__PURE__*/_interopNamespace(PDFJSlib);
var PDFJSLib__namespace = /*#__PURE__*/_interopNamespace(PDFJSLib);
var PDFJSWorker__default = /*#__PURE__*/_interopDefaultLegacy(PDFJSWorker);
PDFJSlib__namespace.GlobalWorkerOptions.workerSrc = PDFJSWorker__default["default"];
/**
*
* @param {string | URL | TypedArray | PDFDataRangeTransport | DocumentInitParameters} src
* Can be a URL where a PDF file is located, a typed array (Uint8Array) already populated with data, or a parameter object.
* @param {function} onProgress
* Callback to request a password if a wrong or no password was provided. The callback receives two parameters: a function that should be called with the new password, and a reason (see PasswordResponses).
* @param {function} onPassword
* Callback to be able to monitor the loading progress of the PDF file (necessary to implement e.g. a loading bar). The callback receives an OnProgressParameters argument.
* @returns
*/
function VuePDF(src, onProgress, onPassword) {
const pdf = vue.ref();
const pages = vue.ref(0);
const info = vue.ref({});
const loadingTask = PDFJSlib__namespace.getDocument(src);
loadingTask.onProgress = onProgress;
loadingTask.onPassword = onPassword;
loadingTask.promise.then((doc) => {
pdf.value = doc.loadingTask;
pages.value = doc.numPages;
doc.getMetadata().then(data => {
info.value = data;
});
});
return {
pdf,
pages,
info
};
}
const INTERNAL_LINK = "internal-link";

@@ -194,3 +157,3 @@ const LINK = "link";

PDFJSlib__namespace.renderTextLayer({
PDFJSLib__namespace.renderTextLayer({
textContent: textContent,

@@ -214,3 +177,3 @@ container: TextlayerREF.value,

PDFJSlib__namespace.AnnotationLayer.render({
PDFJSLib__namespace.AnnotationLayer.render({
annotations: annotations,

@@ -336,3 +299,47 @@ viewport: viewport.clone({ dontFlip: true}),

PDFJSLib__namespace.GlobalWorkerOptions.workerSrc = PDFJSWorker__default["default"];
/**
*
* @param {string | URL | TypedArray | PDFDataRangeTransport | DocumentInitParameters} src
* Can be a URL where a PDF file is located, a typed array (Uint8Array) already populated with data, or a parameter object.
* @param {function} onProgress
* Callback to request a password if a wrong or no password was provided. The callback receives two parameters: a function that should be called with the new password, and a reason (see PasswordResponses).
* @param {function} onPassword
* Callback to be able to monitor the loading progress of the PDF file (necessary to implement e.g. a loading bar). The callback receives an OnProgressParameters argument.
* @returns
*/
function VuePDF(src, onProgress, onPassword) {
const pdf = vue.ref();
const pages = vue.ref(0);
const info = vue.ref({});
const loadingTask = PDFJSLib__namespace.getDocument(src);
loadingTask.onProgress = onProgress;
loadingTask.onPassword = onPassword;
loadingTask.promise.then((doc) => {
pdf.value = doc.loadingTask;
pages.value = doc.numPages;
doc.getMetadata().then(data => {
info.value = data;
});
});
return {
pdf,
pages,
info
};
}
const plugin = {
install(Vue) {
Vue.component(script.name, script);
}
};
exports.PDFProxy = VuePDF;
exports.VuePDF = script;
exports["default"] = plugin;

@@ -0,44 +1,7 @@

import * as PDFJSLib from 'pdfjs-dist/build/pdf';
import { SimpleLinkService } from 'pdfjs-dist/web/pdf_viewer';
import 'pdfjs-dist/web/pdf_viewer.css';
import { ref, watch, onMounted, openBlock, createElementBlock, createElementVNode, createCommentVNode } from 'vue';
import * as PDFJSlib from 'pdfjs-dist/build/pdf';
import PDFJSWorker from 'pdfjs-dist/build/pdf.worker.entry';
import { SimpleLinkService } from 'pdfjs-dist/web/pdf_viewer';
import 'pdfjs-dist/web/pdf_viewer.css';
PDFJSlib.GlobalWorkerOptions.workerSrc = PDFJSWorker;
/**
*
* @param {string | URL | TypedArray | PDFDataRangeTransport | DocumentInitParameters} src
* Can be a URL where a PDF file is located, a typed array (Uint8Array) already populated with data, or a parameter object.
* @param {function} onProgress
* Callback to request a password if a wrong or no password was provided. The callback receives two parameters: a function that should be called with the new password, and a reason (see PasswordResponses).
* @param {function} onPassword
* Callback to be able to monitor the loading progress of the PDF file (necessary to implement e.g. a loading bar). The callback receives an OnProgressParameters argument.
* @returns
*/
function VuePDF(src, onProgress, onPassword) {
const pdf = ref();
const pages = ref(0);
const info = ref({});
const loadingTask = PDFJSlib.getDocument(src);
loadingTask.onProgress = onProgress;
loadingTask.onPassword = onPassword;
loadingTask.promise.then((doc) => {
pdf.value = doc.loadingTask;
pages.value = doc.numPages;
doc.getMetadata().then(data => {
info.value = data;
});
});
return {
pdf,
pages,
info
};
}
const INTERNAL_LINK = "internal-link";

@@ -165,3 +128,3 @@ const LINK = "link";

PDFJSlib.renderTextLayer({
PDFJSLib.renderTextLayer({
textContent: textContent,

@@ -185,3 +148,3 @@ container: TextlayerREF.value,

PDFJSlib.AnnotationLayer.render({
PDFJSLib.AnnotationLayer.render({
annotations: annotations,

@@ -307,2 +270,45 @@ viewport: viewport.clone({ dontFlip: true}),

export { VuePDF as PDFProxy, script as VuePDF };
PDFJSLib.GlobalWorkerOptions.workerSrc = PDFJSWorker;
/**
*
* @param {string | URL | TypedArray | PDFDataRangeTransport | DocumentInitParameters} src
* Can be a URL where a PDF file is located, a typed array (Uint8Array) already populated with data, or a parameter object.
* @param {function} onProgress
* Callback to request a password if a wrong or no password was provided. The callback receives two parameters: a function that should be called with the new password, and a reason (see PasswordResponses).
* @param {function} onPassword
* Callback to be able to monitor the loading progress of the PDF file (necessary to implement e.g. a loading bar). The callback receives an OnProgressParameters argument.
* @returns
*/
function VuePDF(src, onProgress, onPassword) {
const pdf = ref();
const pages = ref(0);
const info = ref({});
const loadingTask = PDFJSLib.getDocument(src);
loadingTask.onProgress = onProgress;
loadingTask.onPassword = onPassword;
loadingTask.promise.then((doc) => {
pdf.value = doc.loadingTask;
pages.value = doc.numPages;
doc.getMetadata().then(data => {
info.value = data;
});
});
return {
pdf,
pages,
info
};
}
const plugin = {
install(Vue) {
Vue.component(script.name, script);
}
};
export { VuePDF as PDFProxy, script as VuePDF, plugin as default };
{
"name": "@tato30/vue-pdf",
"description": "A vue 3 PDFJS wrapper",
"version": "1.0.2",
"version": "1.0.3",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "cjs/index.js",

@@ -0,2 +1,13 @@

import VuePDF from "./components/VuePDF.vue";
const plugin = {
install(Vue) {
Vue.component(VuePDF.name, VuePDF)
}
}
export { default as PDFProxy } from "./components/VuePDFProxy.js";
export { default as VuePDF} from "./components/VuePDF.vue";
export default plugin
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc