@pdfme/pdf-lib
Version:
Create and modify PDF files with JavaScript
21 lines • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("../../../src/core");
const utils_1 = require("../../../src/utils");
describe(`PDFTrailer`, () => {
it(`can be constructed from PDFTrailer.forLastCrossRefSectionOffset(...)`, () => {
expect(core_1.PDFTrailer.forLastCrossRefSectionOffset(21)).toBeInstanceOf(core_1.PDFTrailer);
});
it(`can be converted to a string`, () => {
expect(String(core_1.PDFTrailer.forLastCrossRefSectionOffset(799))).toBe('startxref\n799\n%%EOF');
});
it(`can provide its size in bytes`, () => {
expect(core_1.PDFTrailer.forLastCrossRefSectionOffset(1919).sizeInBytes()).toBe(20);
});
it(`can be serialized`, () => {
const buffer = new Uint8Array(21).fill((0, utils_1.toCharCode)(' '));
expect(core_1.PDFTrailer.forLastCrossRefSectionOffset(1).copyBytesInto(buffer, 3));
expect(buffer).toEqual((0, utils_1.typedArrayFor)(' startxref\n1\n%%EOF '));
});
});
//# sourceMappingURL=PDFTrailer.spec.js.map