1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Support comb textfields for printing

This commit is contained in:
Calixte Denizet 2020-08-06 16:45:17 +02:00 committed by calixteman
parent b061c300b4
commit 88b112ab0c
2 changed files with 66 additions and 0 deletions

View file

@ -1781,6 +1781,46 @@ describe("annotation", function () {
done();
}, done.fail);
});
it("should render comb for printing", function (done) {
textWidgetDict.set("Ff", AnnotationFieldFlag.COMB);
textWidgetDict.set("MaxLen", 4);
const textWidgetRef = Ref.get(271, 0);
const xref = new XRefMock([
{ ref: textWidgetRef, data: textWidgetDict },
fontRefObj,
]);
const task = new WorkerTask("test print");
partialEvaluator.xref = xref;
AnnotationFactory.create(
xref,
textWidgetRef,
pdfManagerMock,
idFactoryMock
)
.then(annotation => {
const id = annotation.data.id;
const annotationStorage = {};
annotationStorage[id] = "aa(aa)a\\";
return annotation._getAppearance(
partialEvaluator,
task,
annotationStorage
);
}, done.fail)
.then(appearance => {
expect(appearance).toEqual(
"/Tx BMC q BT /Helv 5 Tf 1 0 0 1 2 2 Tm" +
" (a) Tj 8.00 0 Td (a) Tj 8.00 0 Td (\\() Tj" +
" 8.00 0 Td (a) Tj 8.00 0 Td (a) Tj" +
" 8.00 0 Td (\\)) Tj 8.00 0 Td (a) Tj" +
" 8.00 0 Td (\\\\) Tj ET Q EMC"
);
done();
}, done.fail);
});
});
describe("ButtonWidgetAnnotation", function () {