Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2982,8 +2982,8 @@ class PartialEvaluator {
currentTextState !== textState &&
(currentTextState.fontSize !== textState.fontSize ||
(currentTextState.fontName !== textState.fontName &&
(currentTextState.font.name !== textState.font.name ||
currentTextState.font.vertical !== textState.font.vertical)))
(currentTextState.font?.name !== textState.font?.name ||
currentTextState.font?.vertical !== textState.font?.vertical)))
) {
flushTextContentItem();
currentTextState = textState.clone();
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
!bug1337429.pdf
!bug1606566.pdf
!bug2086012.pdf
!issue22381.pdf
!issue5564_reduced.pdf
!canvas.pdf
!bug1132849.pdf
Expand Down
Binary file added test/pdfs/issue22381.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14647,6 +14647,13 @@
"rounds": 1,
"type": "eq"
},
{
"id": "issue22381",
"file": "pdfs/issue22381.pdf",
"md5": "3f5fd4d65e246557510fefa4bd6cebcb",
"rounds": 1,
"type": "text"
},
{
"id": "devicen-none-zero-domain",
"file": "pdfs/devicen-none-zero-domain.pdf",
Expand Down
15 changes: 15 additions & 0 deletions test/unit/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5600,6 +5600,21 @@ have written that much by now. So, here’s to squashing bugs.`);
await loadingTask.destroy();
});

it("gets text content when the first text has a zero font size (issue 22381)", async function () {
const loadingTask = getDocument(
buildGetDocumentParams("issue22381.pdf", { stopAtErrors: true })
);
const pdfDoc = await loadingTask.promise;
const pdfPage = await pdfDoc.getPage(1);
const { items } = await pdfPage.getTextContent({
disableNormalization: true,
});
const text = mergeText(items);
expect(text).toEqual("hiddenVisible text");

await loadingTask.destroy();
});

it("gets empty structure tree", async function () {
const tree = await page.getStructTree();

Expand Down
Loading