I am trying to download a PDF file in Angular from a call to the backend, I have tried a bunch of different methods but get the same results: "Http failure during parsing for https://localhost:44367/downloadreport/f6f8401a-26d6-0ed6-30f8-39fef69a5343" Unexpected token % in JSON at position 0 text: 772 kb
On my backend I have tried creating a controller that return RemoteStreamContent like this:
[HttpGet]
[Route("downloadreport/{userTestId}")]
public async Task<RemoteStreamContent> DownloadReportAsync(Guid userTestId)
{
var fileDto = await _reportService.GetPDFReport(userTestId);
MemoryStream stream = new MemoryStream(fileDto.Content);
return new RemoteStreamContent(stream, fileDto.Name);
}
I have also tried returning a File() like this:
[HttpGet]
[Route("downloadreport/{userTestId}")]
public async Task<IActionResult> DownloadReportAsync(Guid userTestId)
{
var fileDto = await _reportService.GetPDFReport(userTestId);
return File(fileDto.Content, "application/octet-stream", fileDto.Name);
}
In Angular I have the following code: downloadUserTest(id: string) { this.reportService.downloadReport(id).subscribe(x => { console.log(x); }); }
Am trying to figure out what I am doing wrong, can someone help please ?
Thanks!
Hi,
I was wondering if there is a way to add additional settings to Administration/Settings pages in Angular ? Currently there are four tabs: Emailing Identity Management Lepton Theme Account
Can we add a fourth tab ?