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

react-pdf-js

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-pdf-js - npm Package Compare versions

Comparing version 1.0.25 to 1.0.26

16

lib/Pdf.js

@@ -226,3 +226,3 @@ 'use strict';

if (!!props.file) {
if (props.file) {
var _ret = function () {

@@ -245,3 +245,3 @@ if (typeof props.file === 'string') {

this.loadByteArray(props.binaryContent);
} else if (!!props.content) {
} else if (props.content) {
var bytes = window.atob(props.content);

@@ -254,3 +254,3 @@ var byteLength = bytes.length;

this.loadByteArray(byteArray);
} else if (!!props.documentInitParameters) {
} else if (props.documentInitParameters) {
return this.getDocument(props.documentInitParameters);

@@ -285,3 +285,3 @@ } else {

// Main loop deals with bytes in chunks of 3
for (var i = 0; i < mainLength; i = i + 3) {
for (var i = 0; i < mainLength; i += 3) {
// Combine the three bytes into a single integer

@@ -330,3 +330,3 @@ chunk = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2];

if (page) {
var canvas = this.refs.canvas;
var canvas = this.canvas;

@@ -345,6 +345,10 @@ var canvasContext = canvas.getContext('2d');

value: function render() {
var _this3 = this;
var loading = this.props.loading;
var page = this.state.page;
return page ? _react2.default.createElement('canvas', { ref: 'canvas' }) : loading || _react2.default.createElement(
return page ? _react2.default.createElement('canvas', { ref: function ref(c) {
return _this3.canvas = c;
} }) : loading || _react2.default.createElement(
'div',

@@ -351,0 +355,0 @@ null,

{
"name": "react-pdf-js",
"version": "1.0.25",
"version": "1.0.26",
"description": "A React component to wrap PDF.js",

@@ -33,3 +33,4 @@ "main": "./lib/index.js",

"dependencies": {
"pdfjs-dist": "1.5.361"
"pdfjs-dist": "1.5.365",
"react": "15.3.0"
},

@@ -42,3 +43,3 @@ "devDependencies": {

"babel-plugin-react-transform": "2.0.2",
"babel-plugin-transform-runtime": "6.9.0",
"babel-plugin-transform-runtime": "6.12.0",
"babel-plugin-typecheck": "3.9.0",

@@ -48,8 +49,7 @@ "babel-preset-es2015": "6.9.0",

"babel-runtime": "6.11.6",
"eslint": "2.13.1",
"eslint-config-airbnb": "9.0.1",
"eslint": "3.2.2",
"eslint-config-airbnb": "10.0.0",
"eslint-plugin-import": "1.12.0",
"eslint-plugin-react": "5.2.2",
"eslint-plugin-jsx-a11y": "1.5.5",
"react": "15.2.1",
"eslint-plugin-react": "6.0.0",
"eslint-plugin-jsx-a11y": "2.0.1",
"rifraf": "2.0.2",

@@ -56,0 +56,0 @@ "rimraf": "2.5.4",

import Pdf from './Pdf';
export default Pdf;
import React from 'react';
require('pdfjs-dist/build/pdf.combined');

@@ -138,3 +139,3 @@ require('pdfjs-dist/web/compatibility');

loadPDFDocument(props) {
if (!!props.file) {
if (props.file) {
if (typeof props.file === 'string') {

@@ -150,3 +151,3 @@ return this.getDocument(props.file);

this.loadByteArray(props.binaryContent);
} else if (!!props.content) {
} else if (props.content) {
const bytes = window.atob(props.content);

@@ -159,3 +160,3 @@ const byteLength = bytes.length;

this.loadByteArray(byteArray);
} else if (!!props.documentInitParameters) {
} else if (props.documentInitParameters) {
return this.getDocument(props.documentInitParameters);

@@ -187,3 +188,3 @@ } else {

// Main loop deals with bytes in chunks of 3
for (let i = 0; i < mainLength; i = i + 3) {
for (let i = 0; i < mainLength; i += 3) {
// Combine the three bytes into a single integer

@@ -230,3 +231,3 @@ chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];

if (page) {
const { canvas } = this.refs;
const { canvas } = this;
const canvasContext = canvas.getContext('2d');

@@ -244,3 +245,3 @@ const { scale } = this.props;

const { page } = this.state;
return page ? <canvas ref="canvas" /> : loading || <div>Loading PDF...</div>;
return page ? <canvas ref={c => this.canvas = c} /> : loading || <div>Loading PDF...</div>;
}

@@ -247,0 +248,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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