MCPcopy Index your code
hub / github.com/foliojs/pdfkit / addPage

Method addPage

lib/document.js:144–175  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

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);

Callers 15

constructorMethod · 0.95
continueOnNewPageMethod · 0.95
outline.spec.jsFile · 0.80
pdfa2.spec.jsFile · 0.80
pdfa3.spec.jsFile · 0.80
acroform.spec.jsFile · 0.80
page.spec.jsFile · 0.80
pdfa1.spec.jsFile · 0.80
vector.spec.jsFile · 0.80
absolute.spec.jsFile · 0.80

Calls 3

flushPagesMethod · 0.95
pushMethod · 0.80
emitMethod · 0.80

Tested by

no test coverage detected