Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing a custom pdfjs build #622

Merged
merged 1 commit into from
Apr 5, 2023
Merged

Allow passing a custom pdfjs build #622

merged 1 commit into from
Apr 5, 2023

Conversation

nfcampos
Copy link
Collaborator

@nfcampos nfcampos commented Apr 5, 2023

No description provided.

Verified

This commit was signed with the committer’s verified signature.
vergoh Teemu Toivola
@vercel
Copy link

vercel bot commented Apr 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2023 7:55am

@Hormold
Copy link

Hormold commented Apr 5, 2023

Please, merge it!

@nfcampos nfcampos merged commit 5e6f8dc into main Apr 5, 2023
@nfcampos nfcampos deleted the nc/custom-pdfjs branch April 5, 2023 13:13
@titocosta
Copy link

Notice that in the documentation page at https://js.langchain.com/docs/modules/indexes/document_loaders/examples/file_loaders/pdf , the code example should only be:

import { PDFLoader } from "langchain/document_loaders";

const loader = new PDFLoader("src/document_loaders/example_data/example.pdf", {
  pdfjs: () =>
    import("pdfjs-dist/legacy/build/pdf.js"),
});

Without .then((mod) => mod.default), otherwise it throws an error:

TypeError: Cannot destructure property 'getDocument' of '(intermediate value)' as it is undefined.
    at PDFLoader.parse (file:///Users/.../node_modules/langchain/dist/document_loaders/pdf.js:22:17)

@mengjian-github
Copy link

Notice that in the documentation page at https://js.langchain.com/docs/modules/indexes/document_loaders/examples/file_loaders/pdf , the code example should only be:

import { PDFLoader } from "langchain/document_loaders";

const loader = new PDFLoader("src/document_loaders/example_data/example.pdf", {
  pdfjs: () =>
    import("pdfjs-dist/legacy/build/pdf.js"),
});

Without .then((mod) => mod.default), otherwise it throws an error:

TypeError: Cannot destructure property 'getDocument' of '(intermediate value)' as it is undefined.
    at PDFLoader.parse (file:///Users/.../node_modules/langchain/dist/document_loaders/pdf.js:22:17)

same to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PDFLoader not working
5 participants