modesty / modesty/pdf2json

Blank text file when Parsing a PDF to create a .txt file but works with command line

Open
#76 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
2.2k
Forks
394
Avg merge
3d 5h
Merged PRs (30d)
7

Description

The code provided to create a text file produces a blank text file. The process to create a text file however works with running the command line argument. Here command line also produces the json and the text file.

let fs = require('fs'),
PDFParser = require("./pdf2json/PDFParser");

let pdfParser = new PDFParser();

pdfParser.on("pdfParser_dataError", errData => console.error(errData.parserError) );
pdfParser.on("pdfParser_dataReady", pdfData => {
    fs.writeFile("./pdf2json/test/F1040EZ.content.txt", pdfParser.getRawTextContent());
});

pdfParser.loadPDF("./pdf2json/test/pdf/fd/form/F1040EZ.pdf");

my pdf file only contains text.

This has been also raised on the stackoverflow but no one has been able to resolve this.

Hope you can help.

Regards,
Jai

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PDFParser usage in the issue, especially loadPDF, the pdfParser_dataReady event, and getRawTextContent(). Reproduce the result with ./pdf2json/test/pdf/fd/form/F1040EZ.pdf and compare the API path with the command-line path. Done means the API-generated F1040EZ.content.txt contains the PDF's extracted text rather than being blank.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.