getRawTextContent() method not consistent in multiple sequential calls
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu từ getRawTextContent() và các handler pdfParser_dataReady trong compareGeneratedReportContent, sau đó tái hiện hành vi được báo cáo bằng các lần gọi tuần tự với các đối số PDF khác nhau. Xác minh rằng mỗi lần gọi trả về và ghi nội dung thô của chính đầu vào tương ứng, thay vì giữ lại nội dung từ một lần gọi trước đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Java
- Star
- 2.2k
- Fork
- 396
- Merge trung bình
- 9 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modesty/pdf2json
-
getRawTextContent() returns the lines of every page in reverse order (bottom to top) since 4.0.3Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
-
`getRawTextContent` does not returns words' pieces in proper coordinate orderCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
-
many warnings in version 4.0.0Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của modesty/pdf2json
Issue tương tự
-
bug subsystem:agent-harness triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ShaftHQ/SHAFT_ENGINE#7797 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ARM: Q flag should be stickyĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
NationalSecurityAgency/ghidra#10155 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area:data coverage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
reacher-z/Awesome-CUA#4864 ·
Maintainer thường phản hồi trong vòng 19 ngày
-
bug web-ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
jenkinsci/jenkins#27705 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
"item-tooltip-keyboard-fix" crashes the game when opening the Items tab of the statistics menuĐang mởmod bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
elmital/FixMCStats#65 · 3 bình luận ·