mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2024-11-21 15:23:26 +01:00
Upgrade pdfjs-dist 2.0.489 to 2.8.335 + build infrastructure upgrades (#20)
This commit is contained in:
parent
96e084a5c3
commit
98eb971533
4953
package-lock.json
generated
4953
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@ -6,11 +6,11 @@
|
||||
"scripts": {
|
||||
"watch": "webpack -d --watch",
|
||||
"build": "webpack",
|
||||
"start": "webpack-dev-server",
|
||||
"start": "webpack serve",
|
||||
"lint": "eslint src --ext .js --ext .jsx --cache",
|
||||
"test": "NODE_ENV=testing mocha --compilers js:babel-core/register test --recursive",
|
||||
"check": "npm run lint && npm run test",
|
||||
"release": "npm run lint && rm -rf build/* && NODE_ENV=production webpack -p",
|
||||
"release": "npm run lint && rm -rf build/* && NODE_ENV=production webpack --mode production",
|
||||
"deploy": "npm run release && cp -r build/* docs/"
|
||||
},
|
||||
"keywords": [
|
||||
@ -27,7 +27,7 @@
|
||||
"dependencies": {
|
||||
"bootstrap": "^3.3.7",
|
||||
"enumify": "^1.0.4",
|
||||
"pdfjs-dist": "^2.0.489",
|
||||
"pdfjs-dist": "^2.8.335",
|
||||
"rc-progress": "^2.0.6",
|
||||
"react": "^15.4.2",
|
||||
"react-bootstrap": "^0.30.7",
|
||||
@ -39,7 +39,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.22.1",
|
||||
"babel-eslint": "^7.1.1",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-plugin-transform-runtime": "^6.22.0",
|
||||
"babel-preset-es2015": "^6.22.0",
|
||||
@ -47,20 +47,20 @@
|
||||
"babel-preset-stage-0": "^6.22.0",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
"chai": "^3.5.0",
|
||||
"copy-webpack-plugin": "^4.0.1",
|
||||
"copy-webpack-plugin": "^9.0.1",
|
||||
"css-loader": "^0.26.1",
|
||||
"esformatter-jsx": "^7.4.1",
|
||||
"eslint": "^4.18.2",
|
||||
"eslint": "^7.30.0",
|
||||
"eslint-plugin-jasmine": "^2.2.0",
|
||||
"eslint-plugin-react": "^6.9.0",
|
||||
"extract-text-webpack-plugin": "^3.0.2",
|
||||
"file-loader": "^0.10.0",
|
||||
"html-webpack-plugin": "^2.22.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"html-webpack-plugin": "^5.3.2",
|
||||
"mocha": "^3.2.0",
|
||||
"style-loader": "^0.13.1",
|
||||
"url-loader": "^0.5.7",
|
||||
"webpack": "^3.11.0",
|
||||
"webpack-cli": "^2.0.15",
|
||||
"webpack-dev-server": "^2.11.1"
|
||||
"webpack": "^5.42.0",
|
||||
"webpack-cli": "^4.7.2",
|
||||
"webpack-dev-server": "^3.11.2"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import FaCheck from 'react-icons/lib/fa/check'
|
||||
|
||||
import pdfjs from 'pdfjs-dist'; // eslint-disable-line no-unused-vars
|
||||
const pdfjs = require('pdfjs-dist'); // eslint-disable-line no-unused-vars
|
||||
import { Line } from 'rc-progress';
|
||||
|
||||
import Metadata from '../models/Metadata.jsx';
|
||||
@ -107,7 +107,7 @@ export default class LoadingView extends React.Component {
|
||||
data: this.props.fileBuffer,
|
||||
cMapUrl: 'cmaps/',
|
||||
cMapPacked: true
|
||||
}).then(function(pdfDocument) { // eslint-disable-line no-undef
|
||||
}).promise.then(function(pdfDocument) { // eslint-disable-line no-undef
|
||||
// console.debug(pdfDocument);
|
||||
pdfDocument.getMetadata().then(function(metadata) {
|
||||
// console.debug(metadata);
|
||||
@ -118,7 +118,7 @@ export default class LoadingView extends React.Component {
|
||||
pdfDocument.getPage(j).then(function(page) {
|
||||
// console.debug(page);
|
||||
var scale = 1.0;
|
||||
var viewport = page.getViewport(scale);
|
||||
var viewport = page.getViewport({scale: scale});
|
||||
|
||||
page.getTextContent().then(function(textContent) {
|
||||
// console.debug(textContent);
|
||||
@ -126,7 +126,7 @@ export default class LoadingView extends React.Component {
|
||||
//trigger resolving of fonts
|
||||
const fontId = item.fontName;
|
||||
if (!self.state.fontIds.has(fontId) && fontId.startsWith('g_d0')) {
|
||||
self.state.document.transport.commonObjs.get(fontId, function(font) {
|
||||
self.state.document._transport.commonObjs.get(fontId, function(font) {
|
||||
self.fontParsed(fontId, font);
|
||||
});
|
||||
self.state.fontIds.add(fontId);
|
||||
@ -149,7 +149,7 @@ export default class LoadingView extends React.Component {
|
||||
font: item.fontName
|
||||
});
|
||||
});
|
||||
self.pageParsed(page.pageIndex, textItems);
|
||||
self.pageParsed(page._pageIndex, textItems);
|
||||
});
|
||||
page.getOperatorList().then(function() {
|
||||
// do nothing... this is only for triggering the font retrieval
|
||||
|
@ -33,11 +33,11 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
loader: "style-loader!css-loader"
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.png$/,
|
||||
loader: "url-loader?limit=100000"
|
||||
use: ["url-loader?limit=100000"]
|
||||
},
|
||||
{
|
||||
test: /\.jpg$/,
|
||||
@ -45,19 +45,19 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
|
||||
use: ['url-loader?limit=10000&mimetype=application/font-woff']
|
||||
},
|
||||
{
|
||||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url-loader?limit=10000&mimetype=application/octet-stream'
|
||||
use: ['url-loader?limit=10000&mimetype=application/octet-stream']
|
||||
},
|
||||
{
|
||||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'file-loader'
|
||||
use: ['file-loader']
|
||||
},
|
||||
{
|
||||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
|
||||
use: ['url-loader?limit=10000&mimetype=image/svg+xml']
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -71,23 +71,35 @@ module.exports = {
|
||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development')
|
||||
}
|
||||
}),
|
||||
new CopyWebpackPlugin([
|
||||
new CopyWebpackPlugin(
|
||||
{
|
||||
from: NODEMODULES_DIR + '/pdfjs-dist/build/pdf.worker.js',
|
||||
to: 'bundle.worker.js'
|
||||
},
|
||||
]),
|
||||
new CopyWebpackPlugin([
|
||||
patterns: [
|
||||
{
|
||||
from: NODEMODULES_DIR + '/pdfjs-dist/build/pdf.worker.js',
|
||||
to: 'bundle.worker.js'
|
||||
},
|
||||
]
|
||||
}
|
||||
),
|
||||
new CopyWebpackPlugin(
|
||||
{
|
||||
from: NODEMODULES_DIR + '/pdfjs-dist/cmaps',
|
||||
to: 'cmaps'
|
||||
},
|
||||
]),
|
||||
new CopyWebpackPlugin([
|
||||
patterns: [
|
||||
{
|
||||
from: NODEMODULES_DIR + '/pdfjs-dist/cmaps',
|
||||
to: 'cmaps'
|
||||
},
|
||||
]
|
||||
}
|
||||
),
|
||||
new CopyWebpackPlugin(
|
||||
{
|
||||
from: 'favicons',
|
||||
to: 'favicons'
|
||||
},
|
||||
])
|
||||
patterns: [
|
||||
{
|
||||
from: 'favicons',
|
||||
to: 'favicons'
|
||||
},
|
||||
]
|
||||
}
|
||||
)
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user