Skip to content

Commit 2de170c

Browse files
committed
#3065 fixed getPageAsLines() omitting the final text chunk when it has an end-of-line flag
1 parent 4be5ad8 commit 2de170c

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

projects/ngx-extended-pdf-viewer/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,3 +693,4 @@
693693
- 25.6.0-alpha.26 stephanrauh/ngx-extended-pdf-viewer#2673 recalculate the div height when switching from infinite scroll to single-page mode; dependency update; faster compilation when developing; fixed layout glitches in the toolbar and the secondary menu; close the secondary menu when changing the page view mode
694694
- 25.6.0-rc.1 improved publishing automation; updated stable branch to pdf.js version 5.4.296
695695
- 25.6.0-rc.2 #3061 prevent annotation editor popup toolbars from flashing when programmatically adding annotations via `addHighlightToAnnotationLayer()`, `addImageToAnnotationLayer()`, or `addEditorAnnotation()`
696+
- 25.6.0-rc.3 #3065 fixed `getPageAsLines()` omitting the final text chunk when it has an end-of-line flag

projects/ngx-extended-pdf-viewer/src/lib/ngx-extended-pdf-viewer.service.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -273,23 +273,24 @@ export class NgxExtendedPdfViewerService {
273273
let lines = new Array<Line>();
274274
for (let i = 0; i < snippets.length; i++) {
275275
const currentSnippet = snippets[i];
276-
if (!currentSnippet.hasEOL) {
277-
const x = currentSnippet.transform[4];
278-
const y = -currentSnippet.transform[5];
279-
const width = currentSnippet.width;
280-
const height = currentSnippet.height;
281-
minX = Math.min(minX, x);
282-
minY = Math.min(minY, y);
283-
maxX = Math.max(maxX, x + width);
284-
maxY = Math.max(maxY, y + height);
285-
text += currentSnippet.str;
286-
if (currentSnippet.dir === 'rtl') {
287-
countRTL++;
288-
}
289-
if (currentSnippet.dir === 'ltr') {
290-
countLTR++;
291-
}
276+
// #3065 modified by ngx-extended-pdf-viewer
277+
// Always process the current snippet's text and bounds, regardless of hasEOL
278+
const x = currentSnippet.transform[4];
279+
const y = -currentSnippet.transform[5];
280+
const width = currentSnippet.width;
281+
const height = currentSnippet.height;
282+
minX = Math.min(minX, x);
283+
minY = Math.min(minY, y);
284+
maxX = Math.max(maxX, x + width);
285+
maxY = Math.max(maxY, y + height);
286+
text += currentSnippet.str;
287+
if (currentSnippet.dir === 'rtl') {
288+
countRTL++;
289+
}
290+
if (currentSnippet.dir === 'ltr') {
291+
countLTR++;
292292
}
293+
// #3065 end of modification by ngx-extended-pdf-viewer
293294

294295
let addIt = i === snippets.length - 1 || currentSnippet.hasEOL;
295296
if (addIt) {

0 commit comments

Comments
 (0)