Print option not working on Mobile browser

21 views Asked by At

I have loaded pdf using Iframe in webpage, on windows browser print option works fine , but in mobile browser it dis not works as expected. In Android if click print we see all blank pages and in iphone only the first page we can see. code as follow.

 window.print = function () {
    if (activeService) {
      console.warn(
        "Ignored window.print() because of a pending print job."
      );
      return;
    }

    ensureOverlay().then(function () {
      if (activeService) {
        overlayManager.open(dialog);
      }
    });

    try {
      dispatchEvent("beforeprint");
    } finally {
      if (!activeService) {
        console.error("Expected print service to be initialized.");
        ensureOverlay().then(function () {
          if (overlayManager.active === dialog) {
            overlayManager.close(dialog);
          }
        });
        return;
      }

      const activeServiceOnEntry = activeService;
      activeService
        .renderPages()
        .then(function () {
          return activeServiceOnEntry.performPrint();
        })
        .catch(function () {})
        .then(function () {
          if (activeServiceOnEntry.active) {
            abort();
          }
        });
    }
  };
0

There are 0 answers