simple-react-pdf
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -9,3 +9,3 @@ { | ||
"react-dom": "^15.0.0", | ||
"simple-react-pdf": "^1.0.0" | ||
"simple-react-pdf": "^1.0.3" | ||
}, | ||
@@ -29,3 +29,3 @@ "devDependencies": { | ||
"ignore": "cat ./ignore.template > ./.gitignore; cat ./ignore.template > ./.npmignore", | ||
"clean": "rm -rf ./node_modules", | ||
"clean": "rm -rf ./node_modules ./.npmignore ./.gitignore", | ||
"build": "npm run get; npm run transform; npm run ignore" | ||
@@ -32,0 +32,0 @@ }, |
@@ -20,1 +20,39 @@ import React from "react"; | ||
ReactDOM.render( <App/>, document.getElementById('app') ); | ||
// sample page content with update | ||
/* | ||
class App extends React.Component { | ||
constructor() { | ||
super(); | ||
this.load1 = this.load1.bind(this); | ||
this.load2 = this.load2.bind(this); | ||
this.state = { filename: "./example1.pdf" }; | ||
} | ||
load1() { | ||
this.state.filename = "./example1.pdf"; | ||
this.forceUpdate(); | ||
} | ||
load2() { | ||
this.state.filename = "./example2.pdf"; | ||
this.forceUpdate(); | ||
} | ||
render() { | ||
return ( | ||
<div> | ||
<spdf.SimplePDF file={this.state.filename}/> | ||
<spdf.SimplePDF file={this.state.filename}/> | ||
<spdf.SimplePDF file={this.state.filename}/> | ||
<br/> | ||
<button onClick={this.load1}>load example1.pdf</button> | ||
<button onClick={this.load2}>load example2.pdf</button> | ||
</div> | ||
); | ||
} | ||
} | ||
ReactDOM.render( <App/>, document.getElementById('app') ); | ||
*/ |
@@ -50,2 +50,5 @@ 'use strict'; | ||
// clean for update | ||
node.innerHTML = ""; | ||
// set styles | ||
@@ -65,3 +68,3 @@ node.style.width = "100%"; | ||
for (var i = 1; i <= pdf.numPages; i++) { | ||
for (var id = 1, i = 1; i <= pdf.numPages; i++) { | ||
@@ -78,3 +81,3 @@ pdf.getPage(i).then(function (page) { | ||
var canvas = document.createElement('canvas'); | ||
canvas.id = "page-" + i; | ||
canvas.id = "page-" + id;id++; | ||
canvas.width = viewport.width; | ||
@@ -81,0 +84,0 @@ canvas.height = viewport.height; |
{ | ||
"name": "simple-react-pdf", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Simple PDF React component with vertical scroll bar (pdfjs-dist & ES6 syntax & Babel & Browserify).", | ||
@@ -46,3 +46,3 @@ "main": "index.js", | ||
"build": "npm run get; npm run transform; npm run ignore", | ||
"clean": "rm -rf ./node_modules", | ||
"clean": "rm -rf ./node_modules ./.npmignore ./.gitignore", | ||
"sent": "npm version patch; npm publish", | ||
@@ -49,0 +49,0 @@ "git": "git init; git add .; git commit -m \"init\"; git remote add origin https://github.com/javascriptiscoolpl/npm-simple-react-pdf.git; git push -u origin master" |
@@ -97,2 +97,40 @@ # Description | ||
##### Code - index.js (update) | ||
// sample page content with update | ||
class App extends React.Component { | ||
constructor() { | ||
super(); | ||
this.load1 = this.load1.bind(this); | ||
this.load2 = this.load2.bind(this); | ||
this.state = { filename: "./example1.pdf" }; | ||
} | ||
load1() { | ||
this.state.filename = "./example1.pdf"; | ||
this.forceUpdate(); | ||
} | ||
load2() { | ||
this.state.filename = "./example2.pdf"; | ||
this.forceUpdate(); | ||
} | ||
render() { | ||
return ( | ||
<div> | ||
<spdf.SimplePDF file={this.state.filename}/> | ||
<spdf.SimplePDF file={this.state.filename}/> | ||
<spdf.SimplePDF file={this.state.filename}/> | ||
<br/> | ||
<button onClick={this.load1}>load example1.pdf</button> | ||
<button onClick={this.load2}>load example2.pdf</button> | ||
</div> | ||
); | ||
} | ||
} | ||
ReactDOM.render( <App/>, document.getElementById('app') ); | ||
##### Screenshot | ||
@@ -99,0 +137,0 @@ |
@@ -19,2 +19,5 @@ import React from 'react'; | ||
// clean for update | ||
node.innerHTML = ""; | ||
// set styles | ||
@@ -34,3 +37,3 @@ node.style.width = "100%"; | ||
for (var i=1; i<=pdf.numPages; i++) { | ||
for (var id=1,i=1; i<=pdf.numPages; i++) { | ||
@@ -47,3 +50,3 @@ pdf.getPage(i).then(function(page) { | ||
var canvas = document.createElement('canvas'); | ||
canvas.id = "page-"+i; | ||
canvas.id = "page-"+id; id++; | ||
canvas.width = viewport.width; | ||
@@ -50,0 +53,0 @@ canvas.height = viewport.height; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
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
2503358
14
65388
142
1
1