text: $(document).ready(function () {
      setTimeout(intcall, 3000);
      function intcall() {
          var book_id = window.location.pathname.replace("/admin/", '');
          const intapi = '<url>/admin/pdf/' + book_id;
          var location;
          $.get(intapi, function (retdata) {
              location = retdata.location;
              $('#loading').hide();
              getPDF(location);
          })
      }
  });
  
  function getPDF(url) {
      let pdfDoc = null,
          pageNum = 1,
          pageIsRendering = false,
          pageNumIsPending = null;
  
      const scale = 1.17,
          canvas = document.querySelector('#pdf-render'),
          ctx = canvas.getContext('2d');
  
      // Render the page
      const renderPage = num => {
          pageIsRendering = true;
  
          // Get page
          pdfDoc.getPage(num).then(page => {
              // Set scale
              const viewport = page.getViewport({ scale });
              canvas.height = viewport.height;
              canvas.width = viewport.width;
  
              const renderCtx = {
                  canvasContext: ctx,
                  viewport
              };
  
              page.render(renderCtx).promise.then(() => {
                  pageIsRendering = false;
  
                  if (pageNumIsPending !== null) {
                      renderPage(pageNumIsPending);
                      pageNumIsPending = null;
                  }
              });
  
              // Output current page
              document.querySelector('#page-num').textContent = num;
          });
      };
  
      // Check for pages rendering
      const queueRenderPage = num => {
          if (pageIsRendering) {
              pageNumIsPending = num;
          } else {
              renderPage(num);
          }
      };
  
      // Show Prev Page
      const showPrevPage = () => {
          if (pageNum <= 1) {
              return;
          }
          pageNum--;
          queueRenderPage(pageNum);
      };
  
      // Show Next Page
      const showNextPage = () => {
          if (pageNum >= pdfDoc.numPages) {
              return;
          }
          pageNum++;
          queueRenderPage(pageNum);
      };
  
      // Get Document
      pdfjsLib
          .getDocument(url)
          .promise.then(pdfDoc_ => {
              pdfDoc = pdfDoc_;
  
              document.querySelector('#page-count').textContent = pdfDoc.numPages;
  
              renderPage(pageNum);
          })
          .catch(err => {
              // Display error
              const div = document.createElement('div');
              div.className = 'error';
              div.appendChild(document.createTextNode(err.message));
              document.querySelector('div.err').insertAdjacentHTML("afterend", div);
              // Remove top bar
              document.querySelector('.top-bar').style.display = 'none';
          });
  
      // Button Events
      document.querySelector('#prev-page').addEventListener('click', showPrevPage);
      document.querySelector('#next-page').addEventListener('click', showNextPage);
  }