UNPKG

@pdfme/pdf-lib

Version:

Create and modify PDF files with JavaScript

22 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("../../../src/core"); const utils_1 = require("../../../src/utils"); describe(`PDFTrailerDict`, () => { const dict = core_1.PDFContext.create().obj({ Foo: 'Bar' }); it(`can be constructed from PDFTrailerDict.of(...)`, () => { expect(core_1.PDFTrailerDict.of(dict)).toBeInstanceOf(core_1.PDFTrailerDict); }); it(`can be converted to a string`, () => { expect(String(core_1.PDFTrailerDict.of(dict))).toBe('trailer\n<<\n/Foo /Bar\n>>'); }); it(`can provide its size in bytes`, () => { expect(core_1.PDFTrailerDict.of(dict).sizeInBytes()).toBe(23); }); it(`can be serialized`, () => { const buffer = new Uint8Array(27).fill((0, utils_1.toCharCode)(' ')); expect(core_1.PDFTrailerDict.of(dict).copyBytesInto(buffer, 3)).toBe(23); expect(buffer).toEqual((0, utils_1.typedArrayFor)(' trailer\n<<\n/Foo /Bar\n>> ')); }); }); //# sourceMappingURL=PDFTrailerDict.spec.js.map