Comparing version 0.2.4 to 0.2.5
{ | ||
"name": "pdfreader", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Read text and parse tables from PDF files. Supports tabular data with automatic column detection, and rule-based parsing.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,4 +21,7 @@ /** | ||
var page = pdf.data.Pages[p]; | ||
var number = ++pageNumber; | ||
handler(null, { | ||
page: ++pageNumber | ||
page: number, | ||
width: pdf.data.Width, | ||
height:pdf.data.Pages[number-1].Height | ||
}); | ||
@@ -25,0 +28,0 @@ for (var t in page.Texts) { |
@@ -9,4 +9,6 @@ [![CircleCI](https://circleci.com/gh/adrienjoly/npm-pdfreader.svg?style=svg)](https://circleci.com/gh/adrienjoly/npm-pdfreader) | ||
This module is meant to be run using Node.js only. **It does not work from a web browser.** | ||
Dependencies: it is based on [pdf2json](https://www.npmjs.com/package/pdf2json), which itself relies on Mozilla's [pdf.js](https://github.com/mozilla/pdf.js/). | ||
ℹ️ This module is meant to be run using Node.js only. **It does not work from a web browser.** | ||
## Installation, tests and CLI usage | ||
@@ -27,3 +29,3 @@ | ||
- `{file:{path:string}}`, when a PDF file is being opened. | ||
- `{page:integer}`, when a new page is being parsed, provides the page number, starting at 1. | ||
- `{page:integer, width:float, height:float}`, when a new page is being parsed, provides the page number, starting at 1. | ||
- `{text:string, x:float, y:float, w:float, h:float...}`, represents each text with its position. | ||
@@ -169,1 +171,23 @@ | ||
``` | ||
## Troubleshooting & FAQ | ||
### Is it possible to parse a PDF document from a web application? | ||
Solutions exist, but this module cannot be run directly by a web browser. If you really want to use this module, you will have to integrate it into your back-end so that PDF files can be read from your server. | ||
## Problem: when I use pdfreader from my express-based node.js app, I'm getting `Cannot read property 'userAgent' of undefined`. | ||
Dmitry found out that you may need to run these instructions before including the `pdfreader` module: | ||
```js | ||
global.navigator = { | ||
userAgent: 'node', | ||
} | ||
window.navigator = { | ||
userAgent: 'node', | ||
} | ||
``` | ||
Source: [express - TypeError: Cannot read property 'userAgent' of undefined error on node.js app run - Stack Overflow](https://stackoverflow.com/questions/49208414/typeerror-cannot-read-property-useragent-of-undefined-error-on-node-js-app-ru) |
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
57778
729
191