document-viewer-ts
Advanced tools
Comparing version 0.3.0 to 0.3.1-legacy
@@ -10,3 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { GlobalWorkerOptions, getDocument, renderTextLayer } from 'pdfjs-dist'; | ||
import { GlobalWorkerOptions, getDocument, renderTextLayer } from 'pdfjs-dist/legacy/build/pdf'; | ||
const chevronLeft = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-left" viewBox="0 0 16 16"> | ||
@@ -13,0 +13,0 @@ <path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/> |
import React, { useEffect, useRef } from 'react'; | ||
import { GlobalWorkerOptions } from 'pdfjs-dist'; | ||
import { GlobalWorkerOptions } from 'pdfjs-dist/legacy/build/pdf'; | ||
import { renderDocument } from './base'; | ||
@@ -4,0 +4,0 @@ export const Viewer = (props) => { |
@@ -13,3 +13,3 @@ "use strict"; | ||
exports.init = exports.renderDocument = exports.renderPDF = void 0; | ||
const pdfjs_dist_1 = require("pdfjs-dist"); | ||
const pdf_1 = require("pdfjs-dist/legacy/build/pdf"); | ||
const chevronLeft = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-left" viewBox="0 0 16 16"> | ||
@@ -44,3 +44,3 @@ <path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/> | ||
textLayerDiv.style.height = `${vs.height}px`; | ||
yield (0, pdfjs_dist_1.renderTextLayer)({ | ||
yield (0, pdf_1.renderTextLayer)({ | ||
textContent, | ||
@@ -83,3 +83,3 @@ container: textLayerFragment, | ||
zoomButton.className = 'zoom-button'; | ||
const loadingTask = (0, pdfjs_dist_1.getDocument)(documentUrl); | ||
const loadingTask = (0, pdf_1.getDocument)(documentUrl); | ||
try { | ||
@@ -250,3 +250,3 @@ const pdfDocument = yield loadingTask.promise; | ||
const init = (workerSrc) => { | ||
pdfjs_dist_1.GlobalWorkerOptions.workerSrc = workerSrc; | ||
pdf_1.GlobalWorkerOptions.workerSrc = workerSrc; | ||
loadDocuments(); | ||
@@ -253,0 +253,0 @@ window.addEventListener('load', loadDocuments); |
@@ -5,6 +5,6 @@ "use strict"; | ||
const react_1 = require("react"); | ||
const pdfjs_dist_1 = require("pdfjs-dist"); | ||
const pdf_1 = require("pdfjs-dist/legacy/build/pdf"); | ||
const base_1 = require("./base"); | ||
const Viewer = (props) => { | ||
pdfjs_dist_1.GlobalWorkerOptions.workerSrc = props.workerSrc; | ||
pdf_1.GlobalWorkerOptions.workerSrc = props.workerSrc; | ||
const viewerContainer = (0, react_1.useRef)(null); | ||
@@ -11,0 +11,0 @@ (0, react_1.useEffect)(() => { viewerContainer.current && (0, base_1.renderDocument)(viewerContainer.current); }, []); |
{ | ||
"name": "document-viewer-ts", | ||
"version": "0.3.0", | ||
"version": "0.3.1-legacy", | ||
"description": "PDF and MS Doc viewer written in TypeScript for React and vanilla JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
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
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
55629