getRawTextContent() method not consistent in multiple sequential calls
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- javascript, node.js
- 领域
- backend
调研方向
从 getRawTextContent() 和 compareGeneratedReportContent 中的 pdfParser_dataReady 处理程序入手,然后使用不同的 PDF 参数进行连续调用,以重现所报告的行为。验证每次调用返回并写入的是其自身输入的原始内容,而不是保留较早调用中的内容。
由索引模型根据 Issue 内容生成。
描述
This code parses two pdf files and converts to rawtext and removes the line starting with 'Generated' and then compares those two text files.This method is called more than once sequentially and for each call the arguments to the method changes, but the raw content is not getting replaced for the last call.
function compareGeneratedReportContent(samplePDFFile, sampleXLSXText) {
const pdfParser = new PDFParser(this, true)
const pdfParser2 = new PDFParser(this, true)
const pdfExportPath = path.join(__dirname, '../../resources/report-test/PDFExportedFile.pdf')
const xlsxExportPath = path.join(__dirname, '../../resources/report-test/XLSXExportedFile.xlsx')
let content1 = ''
let content2 = ''
let result = false
pdfParser2.on('pdfParser_dataError', errData => console.log(errData))
pdfParser2.on('pdfParser_dataReady', () => {
content2 = pdfParser2.getRawTextContent().replace(/^.*(Generated).+$/mg, '')
// console.log('content2 ', content2)
fs.writeFileSync(path.join(__dirname, '../../resources/report-test/sample.txt'), content2, 'utf-8')
})
pdfParser2.loadPDF(path.join(__dirname, `../../resources/report-test/${samplePDFFile}.pdf`))
pdfParser.on('pdfParser_dataError', errData => console.log(errData))
pdfParser.on('pdfParser_dataReady', () => {
content1 = pdfParser.getRawTextContent().replace(/^.*(Generated).+$/mg, '')
// console.log('content1 ', content1)
fs.writeFileSync(path.join(__dirname, '../../resources/report-test/generated.txt'), content2, 'utf-8')
})
pdfParser.loadPDF(pdfExportPath)
let readContent2 = fs.readFileSync(path.join(__dirname, '../../resources/report-test/sample.txt'), 'utf-8')
let readContent1 = fs.readFileSync(path.join(__dirname, '../../resources/report-test/generated.txt'), 'utf-8')
if (readContent2 === readContent1) {
console.log('Report pdf file content matches')
result = true
} else {
console.log('Error in matching contents of report pdf')
result = false
}
}
```Can anybody help?
Regards,
Fazi
- 主要语言
- Java
- 星标
- 2.2k
- 派生
- 396
- 平均合并
- 9 天 19 小时
- 30 天内合并 PR
- 3
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modesty/pdf2json 的其他 Issue
-
getRawTextContent() returns the lines of every page in reverse order (bottom to top) since 4.0.3未关闭
难度 1/5 1-3 小时 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 3/5 1-2 天 新手友好度 38/100
-
`getRawTextContent` does not returns words' pieces in proper coordinate order可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
bug subsystem:agent-harness triage
难度 2/5 1-3 小时 新手友好度 72/100
ShaftHQ/SHAFT_ENGINE#7797 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
NationalSecurityAgency/ghidra#10155 ·
维护者通常 2 天内回复
-
area:data coverage
难度 1/5 1 小时以内 新手友好度 67/100
reacher-z/Awesome-CUA#4864 ·
维护者通常 19 天内回复
-
bug web-ui
难度 2/5 1-3 小时 新手友好度 67/100
jenkinsci/jenkins#27705 · 3 条评论 ·
维护者通常 1 天内回复
-
mod bug
难度 2/5 1-3 小时 新手友好度 64/100
elmital/FixMCStats#65 · 3 条评论 ·