I have this code snippet that returns a string that is a path to a pdf file. I was wondering, instead of returning just the string, can I get it to automatically download the pdf in the browser after I make this call? If so, how?
getMergedPDF(filesToUpload: Array<string>) {
return this.http.post<string>('http://localhost:8080/merge-pdf', filesToUpload)
.subscribe(data => this.mergedUrl = data);
}
Where string returned above is a file path: /Users/foo/Documents/PDFMerger/PDFMerger/server/test-pdfs/merged-pdf.pdf
EDIT: When I try the solutions below, the file fails to load.