Skip to content

Instantly share code, notes, and snippets.

@tkdn
Created February 24, 2023 03:02
Show Gist options
  • Save tkdn/74bbaf33f6e20b8f3aa6bae4750e21d0 to your computer and use it in GitHub Desktop.
Save tkdn/74bbaf33f6e20b8f3aa6bae4750e21d0 to your computer and use it in GitHub Desktop.
PDF からリンク抽出(失敗)
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