Skip to content

Commit 28fb397

Browse files
Merge pull request #14266 from calixteman/bug931481
Don't consider space as real space when there is an extra spacing (bug 931481)
2 parents 7d6d3fc + a88ff34 commit 28fb397

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

src/core/evaluator.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2573,7 +2573,8 @@ class PartialEvaluator {
25732573
(i === 0 ||
25742574
i + 1 === ii ||
25752575
glyphs[i - 1].unicode === " " ||
2576-
glyphs[i + 1].unicode === " ")
2576+
glyphs[i + 1].unicode === " " ||
2577+
extraSpacing)
25772578
) {
25782579
// Don't push a " " in the textContentItem
25792580
// (except when it's between two non-spaces chars),

test/pdfs/bug931481.pdf.link

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://web.archive.org/web/20141210054406/http://www.stronachinstitut.at/wp-content/uploads/2012/02/Nachbaur_CV5.pdf

test/test_manifest.json

+7
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@
171171
"type": "eq",
172172
"about": "Fonts referenced only by name and not by an object identifier."
173173
},
174+
{ "id": "bug931481",
175+
"file": "pdfs/bug931481.pdf",
176+
"md5": "547de872cbb2ecc653ae83d5be7e5be9",
177+
"rounds": 1,
178+
"link": true,
179+
"type": "text"
180+
},
174181
{ "id": "bug911034",
175182
"file": "pdfs/bug911034.pdf",
176183
"md5": "54ee432a4e16b26b242fbf549cdad177",

test/unit/api_spec.js

+28
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,34 @@ sources, for full support with Dvips.`)
17601760
await loadingTask.destroy();
17611761
});
17621762

1763+
it("gets text content, with negative spaces (bug 931481)", async function () {
1764+
if (isNodeJS) {
1765+
pending("Linked test-cases are not supported in Node.js.");
1766+
}
1767+
1768+
const loadingTask = getDocument(buildGetDocumentParams("bug931481.pdf"));
1769+
const pdfDoc = await loadingTask.promise;
1770+
const pdfPage = await pdfDoc.getPage(1);
1771+
const { items } = await pdfPage.getTextContent();
1772+
const text = mergeText(items);
1773+
1774+
expect(
1775+
text.includes(`Kathrin Nachbaur
1776+
Die promovierte Juristin ist 1979 in Graz geboren und aufgewachsen. Nach
1777+
erfolgreichem Studienabschluss mit Fokus auf Europarecht absolvierte sie ein
1778+
Praktikum bei Magna International in Kanada in der Human Resources Abteilung.
1779+
Anschliessend wurde sie geschult in Human Resources, Arbeitsrecht und
1780+
Kommunikation, währenddessen sie auch an ihrem Doktorat im Wirtschaftsrecht
1781+
arbeitete. Seither arbeitete sie bei Magna International als Projekt Manager in der
1782+
Innovationsabteilung. Seit 2009 ist sie Frank Stronachs Büroleiterin in Österreich und
1783+
Kanada. Zusätzlich ist sie seit 2012 Vice President, Business Development der
1784+
Stronach Group und Vizepräsidentin und Institutsleiterin des Stronach Institut für
1785+
sozialökonomische Gerechtigkeit.`)
1786+
).toEqual(true);
1787+
1788+
await loadingTask.destroy();
1789+
});
1790+
17631791
it("gets text content, with beginbfrange operator handled correctly (bug 1627427)", async function () {
17641792
const loadingTask = getDocument(
17651793
buildGetDocumentParams("bug1627427_reduced.pdf")

0 commit comments

Comments
 (0)