pdf2md-ts
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

pdf2md-ts

Forked from @opendocsg/pdf2md

Major Changes

[2024-3-2]

  1. Add types to the package, typescript needs types!
  2. Change to return markdown by pages, return string[].
  3. 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

Package Sidebar

Install

npm i pdf2md-ts

Weekly Downloads

24

Version

1.1.1

License

MIT

Unpacked Size

93.3 kB

Total Files

45

Last publish

Collaborators

  • devilyouwei