pdfjs-dist is not working
Unanswered
Bengal posted this in #help-forum
BengalOP
Hi, I am trying to get pdfjs-dist(mozilla) to work but with not success.
Here is the simple snippet to reproduce the problem. Error being returned is
Here is the simple snippet to reproduce the problem. Error being returned is
TypeError: Promise.withResolvers is not a function.import { getDocument } from 'pdfjs-dist'
export async function GET(request) {
const url = 'https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/examples/learning/helloworld.pdf';
const pdf = await getDocument(url).promise
const page = await pdf.getPage(1)
const text = page.getTextContent()
return Response.json({ text })
}