How do I load all pages?

Hello , I need a help for this following code. This is a code load per page in canvas may you please help how how load all pages.

loadPage(pageNum: number = 1) {

let pdfPage: PDFPageProxy;

try {

  return this.pdfDocument.getPage(pageNum).then(thisPage => {

    pdfPage = thisPage;

    return this.renderOnePage(pdfPage);

  }).then(() => {

    this.allowpinch=true;

    this.setGestures();

    return pdfPage;

  });

} catch (err) {

  console.error(err);

  return this.pdfDocument.getPage(1).then(thisPage => {

    pdfPage = thisPage;

    return this.renderOnePage(pdfPage);

  }).then(() => {

    this.allowpinch=true;

    return pdfPage;

  });

}

}

async renderOnePage(pdfPage: PDFPageProxy) {

let textContainer: HTMLElement;

let canvas: HTMLCanvasElement;

let wrapper: HTMLElement;

let canvasContext: CanvasRenderingContext2D;

let page: HTMLElement

page = this.pageContainerUnique.element;

textContainer = this.pageContainerUnique.textContainer;

canvas = this.pageContainerUnique.canvas;

wrapper = this.pageContainerUnique.canvasWrapper;

canvasContext = canvas.getContext('2d') as CanvasRenderingContext2D;



//Calcuate PageFit

let DEFAULT_SCALE = 1.0;

//let CSS_UNITS = 96/72;

let CSS_UNITS = 96/96;

let default_viewport = pdfPage.getViewport(DEFAULT_SCALE) as PDFPageViewport;

this.scale =  window.screen.width / (default_viewport.width * CSS_UNITS);

console.log("scale",this.scale);

console.log("zoom_pdf",this.zoom_pdf);

let disp_size = this.scale * this.zoom_pdf;

console.log("disp_size",disp_size);

let viewport = pdfPage.getViewport(disp_size) as PDFPageViewport;

canvas.width = viewport.width;

canvas.height = viewport.height;

page.style.width = `${viewport.width}px`;

page.style.height = `${viewport.height}px`;

wrapper.style.width = `${viewport.width}px`;

wrapper.style.height = `${viewport.height}px`;

textContainer.style.width = `${viewport.width}px`;

textContainer.style.height = `${viewport.height}px`;

//

if (window.devicePixelRatio > 1) {

  let canvasWidth = canvas.width;

  let canvasHeight = canvas.height;

  canvas.width = canvasWidth * window.devicePixelRatio;

  canvas.height = canvasHeight * window.devicePixelRatio;

  canvas.style.width = canvasWidth + "px";

  canvas.style.height = canvasHeight + "px";

  canvasContext.scale(window.devicePixelRatio, window.devicePixelRatio);

}

// THIS RENDERS THE PAGE !!!!!!

let renderTask: PDFRenderTask = pdfPage.render({

  canvasContext,

  viewport

});

let container = textContainer;

return renderTask.then(() => {

  //console.error("I WORK JUST UNTIL HERE");

  return pdfPage.getTextContent();

}).then((textContent) => {

  let textLayer: HTMLElement;

  textLayer = this.pageContainerUnique.textContainer

  while (textLayer.lastChild) {

    textLayer.removeChild(textLayer.lastChild);

  }

  this.PDFJSViewer.renderTextLayer({

    textContent,

    container,

    viewport,

    textDivs: []

  });

  return true;

});

}

thanks in advance