diff --git a/CHANGELOG.md b/CHANGELOG.md index 78975df..4713818 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fix setting printing permission - Fix corruption of string objects in browser +- Fix links to pages within the document - Add option to set default font - Remove call to fontkit.openSync - Add standalone virtual file system implementation diff --git a/lib/document.js b/lib/document.js index 76ad20c..f0d4e94 100644 --- a/lib/document.js +++ b/lib/document.js @@ -60,22 +60,6 @@ class PDFDocument extends stream.Readable { Kids: [] }); - Pages.finalize = function() { - this.offset = this.document._offset; - this.document._write(this.id + ' ' + this.gen + ' obj'); - this.document._write('<<'); - this.document._write('/Type /Pages'); - this.document._write(`/Count ${this.data.Count}`); - this.document._write( - `/Kids [${Buffer.concat(this.data.Kids) - .slice(0, -1) - .toString()}]` - ); - this.document._write('>>'); - this.document._write('endobj'); - return this.document._refEnd(this); - }; - this._root = this.ref({ Type: 'Catalog', Pages @@ -140,7 +124,7 @@ class PDFDocument extends stream.Readable { // add the page to the object store const pages = this._root.data.Pages.data; - pages.Kids.push(new Buffer(this.page.dictionary + ' ')); + pages.Kids.push(this.page.dictionary); pages.Count++; // reset x and y coordinates