1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-24 09:08:07 +02:00

[Editor] When saving/printing a FreeText, use the identity matrix for the AP and set the cm when rendering it

When there was a rotation, the generated bbox was wrong because of an inversion
between width and height.
This patch aims to fix this issue in re-writing the FreeText code generation
to have something similar to what Acrobat does.
And fix the name of the font which wasn't the correct one when calling the
evaluator.
This commit is contained in:
Calixte Denizet 2023-07-05 14:58:09 +02:00
parent 6d82f7f66f
commit 77656ce881
2 changed files with 47 additions and 23 deletions

View file

@ -4110,14 +4110,16 @@ describe("annotation", function () {
const appearance = data.dependencies[1].data;
expect(appearance).toEqual(
"3 0 obj\n" +
"<< /FormType 1 /Subtype /Form /Type /XObject /BBox [0 0 44 44] " +
"/Resources << /Font << /Helv 1 0 R>>>> /Length 101>> stream\n" +
"<< /FormType 1 /Subtype /Form /Type /XObject /BBox [12 34 56 78] " +
"/Resources << /Font << /Helv 1 0 R>>>> /Matrix [1 0 0 1 -12 -34] " +
"/Length 98>> stream\n" +
"q\n" +
"0 0 44 44 re W n\n" +
"1 0 0 1 0 0 cm\n" +
"12 34 44 44 re W n\n" +
"BT\n" +
"1 0 0 1 0 47.5 Tm 0 Tc 0 g\n" +
"/Helv 10 Tf\n" +
"0 -13.5 Td (Hello PDF.js World!) Tj\n" +
"0 g\n" +
"0 Tc /Helv 10 Tf\n" +
"12 68 Td (Hello PDF.js World!) Tj\n" +
"ET\n" +
"Q\n" +
"endstream\n" +
@ -4153,13 +4155,13 @@ describe("annotation", function () {
expect(opList.fnArray).toEqual([
OPS.beginAnnotation,
OPS.save,
OPS.transform,
OPS.constructPath,
OPS.clip,
OPS.endPath,
OPS.beginText,
OPS.setTextMatrix,
OPS.setCharSpacing,
OPS.setFillRGBColor,
OPS.setCharSpacing,
OPS.dependency,
OPS.setFont,
OPS.moveText,