Fix links to page numbers within the document

This commit is contained in:
Danny Kirchmeier 2019-04-17 10:41:30 -05:00
parent 1f5565d087
commit c17bf39710
2 changed files with 2 additions and 17 deletions

View File

@ -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

View File

@ -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