Open pdf safari angular 11

Hello
I look for help on a small project that I started a site to read the pdf and classify them well meaning to use a backend

I made the site in angular and a node server to embed it:

I have a problem opening pdf with safari browsers on Macs as well as on mobiles, the link becomes null
while its working on all other browsers

I use this function which works everywhere except safari

downloadOpenPdf (downloadOrOpen: string): void {
this.httpCall.getPdf (this.fileName, this.category) .subscribe (
(data: any) => {
const newBlob = new Blob ([data], {type: 'application / pdf'});
const downloadURL = window.URL.createObjectURL (data);
const link = document.createElement ('a');
link.href = downloadURL;
if (downloadOrOpen == 'open') {
link.target = this.fileName + '.pdf';
}
else {
link.download = this.fileName + '.pdf';
}

link.click ();
setTimeout (() => {
// For Firefox it is necessary to delay revoking the ObjectURL
window.URL.revokeObjectURL (data);
link.remove ();
}, 100);
},
(err: any) => console.log (err)
);
}
}
all the codes

import {Component, Input, OnInit} from '@ angular / core';
import {HttpCallService} from '../services/http-call.service';

@Component ({
selector: 'app-book-tile',
templateUrl: './book-tile.component.html',
styleUrls: ['./book-tile.component.scss']
})
export class BookTileComponent implements OnInit {

public fileName = '';
public category = '';
@Input () set filename (filename: string) {
this.fileName = filename;
}
@Input () set categoryname (categoryName: string) {
this.category = categoryName;
}
constructor (private httpCall: HttpCallService) {}

ngOnInit (): void {
}


downloadOpenPdf (downloadOrOpen: string): void {
this.httpCall.getPdf (this.fileName, this.category) .subscribe (
(data: any) => {
const newBlob = new Blob ([data], {type: 'application / pdf'});
const downloadURL = window.URL.createObjectURL (data);
const link = document.createElement ('a');
link.href = downloadURL;
if (downloadOrOpen == 'open') {
link.target = this.fileName + '.pdf';
}
else {
link.download = this.fileName + '.pdf';
}

link.click ();
setTimeout (() => {
// For Firefox it is necessary to delay revoking the ObjectURL
window.URL.revokeObjectURL (data);
link.remove ();
}, 100);
},
(err: any) => console.log (err)
);
}
}

can help me!