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

utils.converters.PDF2Text (new) convert PDF to text #347

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

DavidDurman
Copy link
Member

No description provided.

// getDocument() does not work over streams.
const loadingTask = pdfjslib.getDocument({ data: await arrayBuffer(readStream) });
const pdfDoc = await loadingTask.promise;
for (let i = 0; i < pdfDoc.numPages; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on this code, it seems that the entire PDF file is not loaded into memory all at once; instead, it is processed page by page. Is that correct?

However, the entire output text is stored in memory. I believe we should consider sending the output text chunks into a stream, or we should introduce a strict limit on the input size of the PDF file. With larger PDF files containing a lot of text, there's a possibility of reaching the memory limit on the instance.

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.

2 participants