Created
February 24, 2023 03:02
-
-
Save tkdn/74bbaf33f6e20b8f3aa6bae4750e21d0 to your computer and use it in GitHub Desktop.
PDF からリンク抽出(失敗)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PDFExtract } from "pdf.js-extract"; | |
const pdfExtract = new PDFExtract(); | |
/** @type {PDFExtractOptions} */ | |
const options = { | |
firstPage: 3, | |
lastPage: 3, | |
}; | |
pdfExtract | |
.extract("test.pdf", options) | |
.then((data) => { | |
const { pages } = data; | |
pages.forEach((page) => { | |
console.log(`Page: ${page.pageInfo.num}`); | |
console.log(`Links: ${page.links}`); | |
page.content.forEach((c) => { | |
console.log(`Content: ${c.str}`); | |
}); | |
}); | |
}) | |
.catch((err) => console.log(err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment