extensions/pdfViewer/pdf/build/pdf.js
function PDFPageProxy_render(params) {
      var stats = this.stats;
      stats.time('Overall');

      // If there was a pending destroy cancel it so no cleanup happens during
      // this call to render.
      this.pendingDestroy = false;

      var renderingIntent = (params.intent === 'print' ? 'print' : 'display');

      if (!this.intentStates[renderingIntent]) {
        this.intentStates[renderingIntent] = {};
      }
      var intentState = this.intentStates[renderingIntent];

      // If there's no displayReadyCapability yet, then the operatorList
      // was never requested before. Make the request and create the promise.
      if (!intentState.displayReadyCapability) {
        intentState.receivingOperatorList = true;
        intentState.displayReadyCapability = createPromiseCapability();
        intentState.operatorList = {
          fnArray: [],
          argsArray: [],
          lastChunk: false
        };

        this.stats.time('Page Request');
        this.transport.messageHandler.send('RenderPageRequest', {
          pageIndex: this.pageNumber - 1,
          intent: renderingIntent
        });
      }

      var internalRenderTask = new InternalRenderTask(complete, params,
                                                      this.objs,
                                                      this.commonObjs,
                                                      intentState.operatorList,
                                                      this.pageNumber);
      internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print';
      if (!intentState.renderTasks) {
        intentState.renderTasks = [];
      }
      intentState.renderTasks.push(internalRenderTask);
      var renderTask = internalRenderTask.task;

      // Obsolete parameter support
      if (params.continueCallback) {
        renderTask.onContinue = params.continueCallback;
      }

      var self = this;
      intentState.displayReadyCapability.promise.then(
        function pageDisplayReadyPromise(transparency) {
          if (self.pendingDestroy) {
            complete();
            return;
          }
          stats.time('Rendering');
          internalRenderTask.initalizeGraphics(transparency);
          internalRenderTask.operatorListChanged();
        },
        function pageDisplayReadPromiseError(reason) {
          complete(reason);
        }
      );

      function complete(error) {
        var i = intentState.renderTasks.indexOf(internalRenderTask);
        if (i >= 0) {
          intentState.renderTasks.splice(i, 1);
        }

        if (self.cleanupAfterRender) {
          self.pendingDestroy = true;
        }
        self._tryDestroy();

        if (error) {
          internalRenderTask.capability.reject(error);
        } else {
          internalRenderTask.capability.resolve();
        }
        stats.timeEnd('Rendering');
        stats.timeEnd('Overall');
      }

      return renderTask;
    }
function PDFPageProxy_render(params) {
      var stats = this.stats;
      stats.time('Overall');

      // If there was a pending destroy cancel it so no cleanup happens during
      // this call to render.
      this.pendingDestroy = false;

      var renderingIntent = (params.intent === 'print' ? 'print' : 'display');

      if (!this.intentStates[renderingIntent]) {
        this.intentStates[renderingIntent] = {};
      }
      var intentState = this.intentStates[renderingIntent];

      // If there's no displayReadyCapability yet, then the operatorList
      // was never requested before. Make the request and create the promise.
      if (!intentState.displayReadyCapability) {
        intentState.receivingOperatorList = true;
        intentState.displayReadyCapability = createPromiseCapability();
        intentState.operatorList = {
          fnArray: [],
          argsArray: [],
          lastChunk: false
        };

        this.stats.time('Page Request');
        this.transport.messageHandler.send('RenderPageRequest', {
          pageIndex: this.pageNumber - 1,
          intent: renderingIntent
        });
      }

      var internalRenderTask = new InternalRenderTask(complete, params,
                                                      this.objs,
                                                      this.commonObjs,
                                                      intentState.operatorList,
                                                      this.pageNumber);
      internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print';
      if (!intentState.renderTasks) {
        intentState.renderTasks = [];
      }
      intentState.renderTasks.push(internalRenderTask);
      var renderTask = internalRenderTask.task;

      // Obsolete parameter support
      if (params.continueCallback) {
        renderTask.onContinue = params.continueCallback;
      }

      var self = this;
      intentState.displayReadyCapability.promise.then(
        function pageDisplayReadyPromise(transparency) {
          if (self.pendingDestroy) {
            complete();
            return;
          }
          stats.time('Rendering');
          internalRenderTask.initalizeGraphics(transparency);
          internalRenderTask.operatorListChanged();
        },
        function pageDisplayReadPromiseError(reason) {
          complete(reason);
        }
      );

      function complete(error) {
        var i = intentState.renderTasks.indexOf(internalRenderTask);
        if (i >= 0) {
          intentState.renderTasks.splice(i, 1);
        }

        if (self.cleanupAfterRender) {
          self.pendingDestroy = true;
        }
        self._tryDestroy();

        if (error) {
          internalRenderTask.capability.reject(error);
        } else {
          internalRenderTask.capability.resolve();
        }
        stats.timeEnd('Rendering');
        stats.timeEnd('Overall');
      }

      return renderTask;
    }
function PDFPageProxy_render ( params ) { var stats = this . stats ; stats . time ( 'Overall' ) ; // If there was a pending destroy cancel it so no cleanup happens during // this call to render. this . pendingDestroy = false ; var renderingIntent = ( params . intent === 'print' ? 'print' : 'display' ) ; if ( ! this . intentStates [ renderingIntent ] ) { this . intentStates [ renderingIntent ] = { } ; } var intentState = this . intentStates [ renderingIntent ] ; // If there's no displayReadyCapability yet, then the operatorList // was never requested before. Make the request and create the promise. if ( ! intentState . displayReadyCapability ) { intentState . receivingOperatorList = true ; intentState . displayReadyCapability = createPromiseCapability ( ) ; intentState . operatorList = { fnArray : [ ] , argsArray : [ ] , lastChunk : false } ; this . stats . time ( 'Page Request' ) ; this . transport . messageHandler . send ( 'RenderPageRequest' , { pageIndex : this . pageNumber - 1 , intent : renderingIntent } ) ; } var internalRenderTask = new InternalRenderTask ( complete , params , this . objs , this . commonObjs , intentState . operatorList , this . pageNumber ) ; internalRenderTask . useRequestAnimationFrame = renderingIntent !== 'print' ; if ( ! intentState . renderTasks ) { intentState . renderTasks = [ ] ; } intentState . renderTasks . push ( internalRenderTask ) ; var renderTask = internalRenderTask . task ; // Obsolete parameter support if ( params . continueCallback ) { renderTask . onContinue = params . continueCallback ; } var self = this ; intentState . displayReadyCapability . promise . then ( function pageDisplayReadyPromise ( transparency ) { if ( self . pendingDestroy ) { complete ( ) ; return ; } stats . time ( 'Rendering' ) ; internalRenderTask . initalizeGraphics ( transparency ) ; internalRenderTask . operatorListChanged ( ) ; } , function pageDisplayReadPromiseError ( reason ) { complete ( reason ) ; } ) ; function complete ( error ) { var i = intentState . renderTasks . indexOf ( internalRenderTask ) ; if ( i >= 0 ) { intentState . renderTasks . splice ( i , 1 ) ; } if ( self . cleanupAfterRender ) { self . pendingDestroy = true ; } self . _tryDestroy ( ) ; if ( error ) { internalRenderTask . capability . reject ( error ) ; } else { internalRenderTask . capability . resolve ( ) ; } stats . timeEnd ( 'Rendering' ) ; stats . timeEnd ( 'Overall' ) ; } return renderTask ; }
Begins the process of rendering a page to the desired context.
@param {RenderParameters} params Page render parameters.
@return {RenderTask} An object that contains the promise, which
is resolved when the page finishes rendering.
Begins the process of rendering a page to the desired context .