mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Flush the current chunk when the font changed because of a restore op (issue #14755)
This commit is contained in:
parent
356f3cf285
commit
3091e70aad
4 changed files with 85 additions and 0 deletions
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -592,3 +592,4 @@
|
|||
!issue14565.pdf
|
||||
!multiline.pdf
|
||||
!bug1825002.pdf
|
||||
!issue14755.pdf
|
||||
|
|
35
test/pdfs/issue14755.pdf
Normal file
35
test/pdfs/issue14755.pdf
Normal file
|
@ -0,0 +1,35 @@
|
|||
%PDF-2.0
|
||||
1 0 obj <</Type /Catalog /Pages 2 0 R>>
|
||||
endobj
|
||||
2 0 obj <</Type /Pages /Kids [3 0 R] /Count 1>>
|
||||
endobj
|
||||
3 0 obj<</Type /Page /Parent 2 0 R /Resources 4 0 R /MediaBox [0 0 500 800] /Contents 7 0 R>>
|
||||
endobj
|
||||
4 0 obj<</Font <</F1 5 0 R /F2 6 0 R>>>>
|
||||
endobj
|
||||
5 0 obj<</Type /Font /Subtype /Type1 /BaseFont /Helvetica>>
|
||||
endobj
|
||||
6 0 obj<</Type /Font /Subtype /Type1 /BaseFont /Helvetica>>
|
||||
endobj
|
||||
7 0 obj
|
||||
<</Length 99>>
|
||||
stream
|
||||
BT /F1 10 Tf 100 100 Td (ABC)Tj ET
|
||||
q BT /F2 10 Tf 120 100 Td (DEF)Tj ET Q
|
||||
BT 140 100 Td (GHI)Tj ET
|
||||
endstream
|
||||
endobj
|
||||
xref
|
||||
0 8
|
||||
0000000000 65535 f
|
||||
0000000009 00000 n
|
||||
0000000056 00000 n
|
||||
0000000111 00000 n
|
||||
0000000212 00000 n
|
||||
0000000260 00000 n
|
||||
0000000327 00000 n
|
||||
0000000394 00000 n
|
||||
trailer <</Size 8/Root 1 0 R>>
|
||||
startxref
|
||||
539
|
||||
%%EOF
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue