Change the format of textContent to be an array
This commit is contained in:
parent
eced7fbb57
commit
668c2867d4
@ -507,10 +507,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
|
|
||||||
getTextContent: function partialEvaluatorGetIRQueue(stream, resources, state) {
|
getTextContent: function partialEvaluatorGetIRQueue(stream, resources, state) {
|
||||||
if (!state) {
|
if (!state) {
|
||||||
state = {
|
state = [];
|
||||||
text: '',
|
|
||||||
mapping: []
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -528,9 +525,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
var res = resources;
|
var res = resources;
|
||||||
var args = [], obj;
|
var args = [], obj;
|
||||||
|
|
||||||
var text = state.text;
|
|
||||||
var chunk = '';
|
var chunk = '';
|
||||||
var commandOffset = state.mapping;
|
|
||||||
var font = null;
|
var font = null;
|
||||||
while (!isEOF(obj = parser.getObj())) {
|
while (!isEOF(obj = parser.getObj())) {
|
||||||
if (isCmd(obj)) {
|
if (isCmd(obj)) {
|
||||||
@ -594,20 +589,16 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
|
|
||||||
// Add some spacing between the text here and the text of the
|
// Add some spacing between the text here and the text of the
|
||||||
// xForm.
|
// xForm.
|
||||||
text = text + ' ';
|
|
||||||
|
|
||||||
state.text = text;
|
|
||||||
state = this.getTextContent(
|
state = this.getTextContent(
|
||||||
xobj,
|
xobj,
|
||||||
xobj.dict.get('Resources') || resources,
|
xobj.dict.get('Resources') || resources,
|
||||||
state
|
state
|
||||||
);
|
);
|
||||||
text = state.text;
|
|
||||||
break;
|
break;
|
||||||
} // switch
|
} // switch
|
||||||
if (chunk !== '') {
|
if (chunk !== '') {
|
||||||
commandOffset.push(text.length);
|
state.push(chunk);
|
||||||
text += chunk;
|
|
||||||
chunk = '';
|
chunk = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,10 +609,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return state;
|
||||||
text: text,
|
|
||||||
mapping: commandOffset
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
|
||||||
extractDataStructures: function
|
extractDataStructures: function
|
||||||
|
@ -1043,7 +1043,7 @@ var PDFView = {
|
|||||||
function extractPageText(pageIndex) {
|
function extractPageText(pageIndex) {
|
||||||
self.pages[pageIndex].pdfPage.getTextContent().then(
|
self.pages[pageIndex].pdfPage.getTextContent().then(
|
||||||
function textContentResolved(textContent) {
|
function textContentResolved(textContent) {
|
||||||
self.pageText[pageIndex] = textContent.text;
|
self.pageText[pageIndex] = textContent.join('');
|
||||||
self.search();
|
self.search();
|
||||||
if ((pageIndex + 1) < self.pages.length)
|
if ((pageIndex + 1) < self.pages.length)
|
||||||
extractPageText(pageIndex + 1);
|
extractPageText(pageIndex + 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user