Parser failing with TypeError: jsFuncName.split is not a function on specific PDF file
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 394
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 7
Description
ATO_tax_form.pdf
I am using version 1.1.7. For most of the cases parses works beautifully.
For one file pdf parsing fails with the exception. I have checked file on other services like which does a PDF Parsing and the PDF is valid fillable pdf and many services are able to extract information out of it. I am attaching pdf file also for reference.
Any inputs on the issue would help.
code snippet ::
let PDFParser = require('pdf2json'); // pdf2json version is 1.1.7
let pdfParser = new PDFParser();
pdfParser.loadPDF('./testingfile.pdf');
Exception trace :::
TypeError: jsFuncName.split is not a function
at processFieldAttribute (/Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:115:33)
at /Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:96:17
at Object.Dict_forEach [as forEach] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :4826:9)
at setupFieldAttributes (/Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:94:14)
at Function.cls.processAnnotation (/Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:192:13)
at TextWidgetAnnotation.WidgetAnnotation [as constructor] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :3827:15)
at new TextWidgetAnnotation (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :3847:22)
at Function.Annotation_fromRef [as fromRef] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :3724:22)
at Object.annotations (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :4424:37)
at LocalPdfManager_ensure [as ensure] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :32503:22)
at Object.Page_getOperatorList [as getOperatorList] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :4352:43)
at Object.eval [as onResolve] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :27397:14)
at Object.runHandlers (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :864:35)
at Timer.listOnTimeout (timers.js:92:15)
[14/01/2017 13:14:33.236 GMT+1100] [ERROR] parsePage error:An error occurred while rendering the page 1:
jsFuncName.split is not a function:
TypeError: jsFuncName.split is not a function
at processFieldAttribute (/Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:115:33)
at /Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:96:17
at Object.Dict_forEach [as forEach] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :4826:9)
at setupFieldAttributes (/Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:94:14)
at Function.cls.processAnnotation (/Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:192:13)
at TextWidgetAnnotation.WidgetAnnotation [as constructor] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :3827:15)
at new TextWidgetAnnotation (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :3847:22)
at Function.Annotation_fromRef [as fromRef] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :3724:22)
at Object.annotations (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :4424:37)
at LocalPdfManager_ensure [as ensure] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :32503:22)
at Object.Page_getOperatorList [as getOperatorList] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :4352:43)
at Object.eval [as onResolve] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :27397:14)
at Object.runHandlers (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :864:35)
at Timer.listOnTimeout (timers.js:92:15)
[14/01/2017 13:14:33.236 GMT+1100] [ERROR] Pdf Parse error ::parsePage error:An error occurred while rendering the page 1:
jsFuncName.split is not a function:
TypeError: jsFuncName.split is not a function
at processFieldAttribute (/Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:115:33)
at /Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:96:17
at Object.Dict_forEach [as forEach] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :4826:9)
at setupFieldAttributes (/Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:94:14)
at Function.cls.processAnnotation (/Users/test/pdf/node_modules/pdf2json/lib/pdfanno.js:192:13)
at TextWidgetAnnotation.WidgetAnnotation [as constructor] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :3827:15)
at new TextWidgetAnnotation (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :3847:22)
at Function.Annotation_fromRef [as fromRef] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :3724:22)
at Object.annotations (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :4424:37)
at LocalPdfManager_ensure [as ensure] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :32503:22)
at Object.Page_getOperatorList [as getOperatorList] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :4352:43)
at Object.eval [as onResolve] (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :27397:14)
at Object.runHandlers (eval at (/Users/test/pdf/node_modules/pdf2json/lib/pdf.js:64:6), :864:35)
at Timer.listOnTimeout (timers.js:92:15)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/pdfanno.js at processFieldAttribute, line 115, and trace how setupFieldAttributes handles annotations. Reproduce the failure using the attached ATO_tax_form.pdf with pdf2json 1.1.7 and the shown loadPDF snippet. Done means the PDF parses without the jsFuncName.split exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100