src/modules/context2d.js
function (y) {
        if (this.pageWrapYEnabled) {
            this.lastBreak = 0;
            var manualBreaks = 0;
            var autoBreaks = 0;
            for (var i = 0; i < this.pageBreaks.length; i++) {
                if (y >= this.pageBreaks[i]) {
                    manualBreaks++;
                    if (this.lastBreak === 0) {
                        autoBreaks++;
                    }
                    var spaceBetweenLastBreak = this.pageBreaks[i] - this.lastBreak;
                    this.lastBreak = this.pageBreaks[i];
                    var pagesSinceLastBreak = Math.floor(spaceBetweenLastBreak / this.pageWrapY);
                    autoBreaks += pagesSinceLastBreak;
                }
            }
            if (this.lastBreak === 0) {
                var pagesSinceLastBreak = Math.floor(y / this.pageWrapY) + 1;
                autoBreaks += pagesSinceLastBreak;
            }
            return autoBreaks + manualBreaks;
        } else {
            return this.pdf.internal.getCurrentPageInfo().pageNumber;
        }
    }
function (y) {
        if (this.pageWrapYEnabled) {
            this.lastBreak = 0;
            var manualBreaks = 0;
            var autoBreaks = 0;
            for (var i = 0; i < this.pageBreaks.length; i++) {
                if (y >= this.pageBreaks[i]) {
                    manualBreaks++;
                    if (this.lastBreak === 0) {
                        autoBreaks++;
                    }
                    var spaceBetweenLastBreak = this.pageBreaks[i] - this.lastBreak;
                    this.lastBreak = this.pageBreaks[i];
                    var pagesSinceLastBreak = Math.floor(spaceBetweenLastBreak / this.pageWrapY);
                    autoBreaks += pagesSinceLastBreak;
                }
            }
            if (this.lastBreak === 0) {
                var pagesSinceLastBreak = Math.floor(y / this.pageWrapY) + 1;
                autoBreaks += pagesSinceLastBreak;
            }
            return autoBreaks + manualBreaks;
        } else {
            return this.pdf.internal.getCurrentPageInfo().pageNumber;
        }
    }
Should only be used if pageWrapYEnabled is true

@name setPageByYPosition
@function
@private
@ignore
@returns One-based Page Number