mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Unify the ReadableStream
and TextContent
code-paths in src/display/text_layer.js
The only reason that this code still accepts `TextContent` is for backward-compatibility purposes, so we can simplify the implementation by always using a `ReadableStream` internally.
This commit is contained in:
parent
b6765403a1
commit
049848ba00
3 changed files with 88 additions and 51 deletions
|
@ -335,15 +335,11 @@ class Rasterize {
|
|||
|
||||
await task.promise;
|
||||
|
||||
const { _pageWidth, _pageHeight, _textContentSource, _textDivs } = task;
|
||||
const { _pageWidth, _pageHeight, _textDivs } = task;
|
||||
const boxes = [];
|
||||
let posRegex;
|
||||
for (
|
||||
let i = 0, j = 0, ii = _textContentSource.items.length;
|
||||
i < ii;
|
||||
i++
|
||||
) {
|
||||
const { width, height, type } = _textContentSource.items[i];
|
||||
let j = 0,
|
||||
posRegex;
|
||||
for (const { width, height, type } of textContent.items) {
|
||||
if (type) {
|
||||
continue;
|
||||
}
|
||||
|
@ -396,7 +392,7 @@ class Rasterize {
|
|||
|
||||
drawLayer.destroy();
|
||||
} catch (reason) {
|
||||
throw new Error(`Rasterize.textLayer: "${reason?.message}".`);
|
||||
throw new Error(`Rasterize.highlightLayer: "${reason?.message}".`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue