Flush the current chunk when the font changed because of a restore op (issue #14755)

This commit is contained in:
Calixte Denizet 2023-05-18 17:22:42 +02:00
parent 356f3cf285
commit 3091e70aad
4 changed files with 85 additions and 0 deletions

View file

@ -2682,6 +2682,43 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
await loadingTask.destroy();
});
it("check that a chunk is pushed when font is restored", async function () {
const loadingTask = getDocument(buildGetDocumentParams("issue14755.pdf"));
const pdfDoc = await loadingTask.promise;
const pdfPage = await pdfDoc.getPage(1);
const { items } = await pdfPage.getTextContent({
disableNormalization: true,
});
expect(items).toEqual([
jasmine.objectContaining({
str: "ABC",
dir: "ltr",
width: 20.56,
height: 10,
transform: [10, 0, 0, 10, 100, 100],
hasEOL: false,
}),
jasmine.objectContaining({
str: "DEF",
dir: "ltr",
width: 20,
height: 10,
transform: [10, 0, 0, 10, 120, 100],
hasEOL: false,
}),
jasmine.objectContaining({
str: "GHI",
dir: "ltr",
width: 17.78,
height: 10,
transform: [10, 0, 0, 10, 140, 100],
hasEOL: false,
}),
]);
expect(items[0].fontName).toEqual(items[2].fontName);
expect(items[1].fontName).not.toEqual(items[0].fontName);
});
it("gets empty structure tree", async function () {
const tree = await page.getStructTree();