Skip to content

An error occurred while parsing the PDF: stream must have data #216

@takoyaro

Description

@takoyaro

I'm getting An error occurred while parsing the PDF: stream must have data when running basic code.

In my root folder where I've got my index.js, I've got a file called nuclear.pdf
nuclear.pdf

My code is as simple as that:

let pdfParser = new PDFParser();

        pdfParser.on("pdfParser_dataError", errData => console.error(errData.parserError) );
        pdfParser.on("pdfParser_dataReady", pdfData => {
            fs.writeFile("./nuclear.json", JSON.stringify(pdfData));
        });
    
        pdfParser.loadPDF("./nuclear.pdf");

I can clearly see PDF has data. I don't think I've done anything wrong. I'd make a PR but I have no idea how to debug this...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions