(options)
| 142 | } |
| 143 | |
| 144 | addPage(options) { |
| 145 | if (options == null) { |
| 146 | ({ options } = this); |
| 147 | } |
| 148 | |
| 149 | // end the current page if needed |
| 150 | if (!this.options.bufferPages) { |
| 151 | this.flushPages(); |
| 152 | } |
| 153 | |
| 154 | // create a page object |
| 155 | this.page = new PDFPage(this, options); |
| 156 | this._pageBuffer.push(this.page); |
| 157 | |
| 158 | // add the page to the object store |
| 159 | const pages = this._root.data.Pages.data; |
| 160 | pages.Kids.push(this.page.dictionary); |
| 161 | pages.Count++; |
| 162 | |
| 163 | // reset x and y coordinates |
| 164 | this.x = this.page.margins.left; |
| 165 | this.y = this.page.margins.top; |
| 166 | |
| 167 | // flip PDF coordinate system so that the origin is in |
| 168 | // the top left rather than the bottom left |
| 169 | this._ctm = [1, 0, 0, 1, 0, 0]; |
| 170 | this.transform(1, 0, 0, -1, 0, this.page.height); |
| 171 | |
| 172 | this.emit('pageAdded'); |
| 173 | |
| 174 | return this; |
| 175 | } |
| 176 | |
| 177 | continueOnNewPage(options) { |
| 178 | const pageMarkings = this.endPageMarkings(this.page); |
no test coverage detected