We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I am using the getRawTextContent() method.
let pdfParser = new PDFParser(this, 1); pdfParser.setPassword(mypassword); pdfParser.on("pdfParser_dataError", errData => console.error(errData.parserError)); pdfParser.on("pdfParser_dataReady", pdfData => { fs.writeFile("parsed.txt", pdfParser.getRawTextContent(), () => {
mypassword
});
Now, if I use the one provided by library, the words in my line don't have proper spacing. However, if I alter the method, it works fine.
eg:
From pdf.js
If I just change
prevText.str += textObj.str;
to
prevText.str += textObj.str + " ";
All my code works fine.
But, I want to know the best way to override this function in my code.
cls.prototype.getRawTextContent = function() { let retVal = ""; if (!this.needRawText) return retVal; _.each(this.rawTextContents, function(textContent, index) { let prevText = null; _.each(textContent.bidiTexts, function(textObj, idx) { if (prevText) { if (Math.abs(textObj.y - prevText.y) <= 9) { **prevText.str += textObj.str;** } else { retVal += prevText.str + "\r\n"; prevText = textObj; } } else { prevText = textObj; } }); if (prevText) { retVal += prevText.str; } retVal += "\r\n----------------Page (" + index + ") Break----------------\r\n"; }); return retVal; };
The text was updated successfully, but these errors were encountered:
I have a very similar problem, did you manage to solve yours? @mandys
Sorry, something went wrong.
No branches or pull requests
Hi,
I am using the getRawTextContent() method.
let pdfParser = new PDFParser(this, 1);
pdfParser.setPassword(
mypassword
);pdfParser.on("pdfParser_dataError", errData => console.error(errData.parserError));
pdfParser.on("pdfParser_dataReady", pdfData => {
fs.writeFile("parsed.txt", pdfParser.getRawTextContent(), () => {
});
Now, if I use the one provided by library, the words in my line don't have proper spacing.
However, if I alter the method, it works fine.
eg:
From pdf.js
If I just change
prevText.str += textObj.str;
to
prevText.str += textObj.str + " ";
All my code works fine.
But, I want to know the best way to override this function in my code.
The text was updated successfully, but these errors were encountered: