pdf2md-ts
v1.1.1
Published
Convert pdf to markdown, support typescript
Downloads
332
Maintainers
Readme
pdf2md-ts
Forked from @opendocsg/pdf2md
Major Changes
[2024-3-2]
- Add types to the package, typescript needs types!
- Change to return markdown by pages, return
string[]
. - Remove CLI scripts.
Usage
npm install --save pdf2md-ts
# or
yarn add pdf2md-ts
Library
ES5
const fs = require('fs')
const pdf2md = require('pdf2md-ts')
const pdfBuffer = fs.readFileSync(filePath)
pdf2md(pdfBuffer, callbacks)
.then(text => {
console.log(text.join('\n'))
})
.catch(err => {
console.error(err)
})
ES6 & TS
import pdf2md from 'pdf2md-ts'
const buffer =readFileSync(path)
const res = await pdf2md(buffer)
console.log(res) // string[]
Credits
- @opendocsg/pdf2md - Which is this repo forked from
- pdf-to-markdown - original project by Johannes Zillmann
- pdf.js - Mozilla's PDF parsing & rendering platform which is used as a raw parser