Pdf download not working on mobile

I’ve created a page that in a button click downloads a specific pdf file from the database. It works fine in the browser but in an actual mobile, it doesn’t download the file.
Thanks in advance!
My code:

    let array = new Uint8Array(item);
    let blob = new Blob([array], { type: 'application/pdf' });
    let url = URL.createObjectURL(blob);
    this.modalName = array;
    let fileName: string = new Date().toLocaleDateString();
    try {
      const link = document.createElement('a');
      if (link.download !== undefined) { 
        link.setAttribute('href', url);
        link.setAttribute('download', fileName);
        link.style.visibility = 'hidden';
    } catch (e) {
      console.error('BlobToSaveAs error', e);

Is there a way I can show the pdf files without the need to download them?

What is the error you are running into?

It doesn’t bring up any errors, but when the button is clicked nothing changes, the functionality of the button is not working.

That’s way too less info to help you. Try adding some console logs to get more information

And maybe try to change your code to use the Angulars HttpClient to download the Blob: typescript - Angular: How to download a file from HttpClient? - Stack Overflow