mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
8 lines
631 B
JavaScript
8 lines
631 B
JavaScript
const createBufferTrailer=(f,r,e)=>{let o=[];return o[0]="0000000000 65535 f ",e.forEach((f,r)=>{f=("0000000000"+f).slice(-10);o[r+1]=r+` 1
|
|
${f} 00000 n `}),o=o.filter(f=>void 0!==f),Buffer.concat([Buffer.from("xref\n"),Buffer.from(r.xref.startingIndex+` 1
|
|
`),Buffer.from(o.join("\n")),Buffer.from("\ntrailer\n"),Buffer.from("<<\n"),Buffer.from(`/Size ${r.xref.maxIndex+1}
|
|
`),Buffer.from(`/Root ${r.rootRef}
|
|
`),Buffer.from(r.infoRef?`/Info ${r.infoRef}
|
|
`:""),Buffer.from(`/Prev ${r.xRefPosition}
|
|
`),Buffer.from(">>\n"),Buffer.from("startxref\n"),Buffer.from(f.length+`
|
|
`),Buffer.from("%%EOF")])};export default createBufferTrailer; |