Skip to content

Commit 5cb6ff3

Browse files
committed
Merge branch 'develop' of github.com:scriptcoded/simple-pdf into develop
2 parents d6a5560 + 2bc1559 commit 5cb6ff3

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

README.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# simple-pdf
22

33
[![npm](https://img.shields.io/npm/v/simple-pdf)](https://www.npmjs.com/package/simple-pdf)
4-
[!![Tests](https://github.com/scriptcoded/simple-pdf/workflows/Tests/badge.svg?branch=master)](https://github.com/scriptcoded/simple-pdf/actions?query=workflow%3ATests+branch%3Amaster)
4+
[![Tests](https://github.com/scriptcoded/simple-pdf/workflows/Tests/badge.svg?branch=master)](https://github.com/scriptcoded/simple-pdf/actions?query=workflow%3ATests+branch%3Amaster)
55
[![david-dm](https://david-dm.org/scriptcoded/simple-pdf.svg)](https://david-dm.org/scriptcoded/simple-pdf)
66

77
`simple-pdf` aims to be a simple drop-in module for extracting text and images
@@ -30,24 +30,24 @@ from PDF files. It exposes a promise-based and an event-based API.
3030
Let's be real. This might not be the library for you. Here are a few reasons why.
3131

3232
- **Slow with images** - Images can be embedded in a PDF in many different ways. To ensure that all types of images can be extracted we render the whole PDF and then use [sharp](https://github.com/lovell/sharp) to extract the images from the rendered page. This adds extra processing time for pages that contains images (provided that you don't disable image extraction).
33-
- **New to the game** - This library is brand new and haven't been battle tested yet. If you're looking for a reliable solution, this library might not be the best choice for you.
33+
- **New to the game** - This library is brand new and hasn't been battle tested yet. If you're looking for a reliable solution, this library might not be the best choice for you.
3434
- **No automated testing** - Though I'm working on this 🙃
3535

3636
## Examples
3737

3838
**Minimal example:**
3939

4040
```javascript
41-
const fs = require('fs');
42-
const { SimplePDFParser } = require('simple-pdf');
41+
const fs = require('fs')
42+
const { SimplePDFParser } = require('simple-pdf')
4343

44-
const fileBuffer = fs.readFileSync('somefile.pdf');
44+
const fileBuffer = fs.readFileSync('somefile.pdf')
4545

46-
const parser = new SimplePDFParser(fileBuffer);
46+
const parser = new SimplePDFParser(fileBuffer)
4747

4848
parser.parse().then((result) => {
4949
console.log(result)
50-
});
50+
})
5151
```
5252

5353
More examples can be found in the `examples` directory and can be run with the following commands:
@@ -126,15 +126,15 @@ const parser = new SimplePDFParser(fileBuffer)
126126

127127
// Called with each page
128128
parser.on('page', (page) => {
129-
console.log(`Page ${page.index}:`);
130-
console.log('Text elements: ', page.textElements);
131-
console.log('Image elements:', page.imageElements);
132-
});
129+
console.log(`Page ${page.index}:`)
130+
console.log('Text elements: ', page.textElements)
131+
console.log('Image elements:', page.imageElements)
132+
})
133133

134134
// Called when the parsing is finished
135135
parser.on('done', () => {
136-
console.log('Parser done');
137-
});
136+
console.log('Parser done')
137+
})
138138

139139
// This must be run even if you just use the events API, but then you may ignore the return value
140140
const result = await parser.parseRaw()
@@ -163,6 +163,19 @@ const result = await parser.parseRaw()
163163
}
164164
```
165165

166+
## Roadmap
167+
168+
More of a todo, but let's call it a roadmap
169+
170+
- [ ] Tests
171+
- [ ] Better coverage
172+
- [ ] Windows - Something is wrong either with the library or the tests (https://github.com/scriptcoded/simple-pdf/runs/1048499489)
173+
- [ ] Make a logo (everyone likes a logo)
174+
- [ ] Rewrite codebase in TypeScript
175+
- [ ] Improve image extraction
176+
- [ ] Set up automatic CI/CD pipeline for NPM deployment
177+
- [ ] Simplify the API
178+
166179
## Tests
167180

168181
Tests can be run with with the following commands:

0 commit comments

Comments
 (0)