Recibo este error de Chrome failed to load PDF document . Estoy devolviendo un byte[] ya que Content y ContentType están configurados en application/pdf . ¿Es esta la forma correcta de mostrar un archivo PDF en Typescript usando una publicación ajax?
ts
printItems(versionKeys: string[]): JQueryPromise<any> { console.log('printItems'); $.ajax({ type: "post", contentType: "application/json", data: JSON.stringify(versionKeys), url: this.apiUrls.PrintTemplates, success: function (data, status, xhr) { console.log(data); var file = new Blob([data.Content], { type: data.ContentType }); var fileURL = URL.createObjectURL(file); window.open(fileURL); console.log('success'); } }); return; }Controlador
[HttpGet, HttpPost] [ApplicationApiAuthorize("Administrator, ContentManager")] public IHttpActionResult PrintTemplates([FromBody] List<string> versionKeys) { var templates = versionKeys .Select(v => TemplatesDataService.GetTemplate(v)) .ToList(); var templateIds = templates.Select(b => b.Id).ToList(); var templateFile = TemplatesDataService.PrintTemplate(templateIds); return Ok(templateFile); }