Skip to content

Commit ebfbe53

Browse files
authored
Merge pull request #299 from tswfi/document_isTextInPDF_deleteComma
better documentation deleteComma in isTextInPDF
2 parents 0b3ed30 + 2e304ed commit ebfbe53

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/file.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default {
100100
* Check text in PDF
101101
* @param filePath {string|null} Path of the PDF file
102102
* @param text {string} Text to check on the file
103-
* @param deleteComma {boolean} True if we need to delete comma
103+
* @param deleteComma {boolean} True if we need to delete comma. PDF to txt conversion adds comma where newlines are.
104104
* @returns {Promise<boolean>}
105105
*/
106106
async isTextInPDF(filePath: string | null, text: string, deleteComma: boolean = false): Promise<boolean> {
@@ -120,6 +120,7 @@ export default {
120120

121121
const pageTexts = await Promise.all(pageTextPromises);
122122

123+
// delete commas from the page text. getPageTextFromPdf adds commas to newlines in some cases
123124
if (deleteComma) {
124125
return ((pageTexts.join(' ').split(/,\//).join('/').split(/,\s*,?/)
125126
.join(' '))

0 commit comments

Comments
 (0)