Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
cómo obtener el contenido del archivo a través de C# en el nodo js

Recibo un archivo pdf de otro servidor que está en C# en el servidor de nodos cuando lo convierto en un búfer de matriz, su tamaño es diferente del tamaño del búfer de matriz de C# y cuando lo abro en el navegador aparece el error "Error al cargar el PDF". documento."

Este es mi código del lado del servidor

 async post(param: any, body: any, endPoint: string, queryParams: string = '') { try { if(queryParams == '') queryParams = param.destinationSlug + '/' + param.mainBranchId; const url = splendidAccountsEndPointsEnum.baseUrl + queryParams + endPoint; const offset = new Date().getTimezoneOffset().toString(); const headerConfig = { headers: { 'X-Api-Key': param.apiKey, 'X-Api-Secret': param.apiSecret, 'X-App-Id': config.get<string>("splendidXAppId"), LocalDateTimeOffset: offset }} const response = await axios.post(url, body, headerConfig) .then(function (response: any) { return response?.data; }) .catch(function (error: any) { console.log(error); return error; }); if (response?.status === 200) { console.log('success'); return response?.data; } return response; } catch (err) { console.error(err); console.log(err); return err; } }

Y este es mi lado del cliente

 let response = this.orderService.generateInvoicePrinting(this.selectedRows) .subscribe((res) => { var file = new Blob([res], {type: 'application/pdf'}); var fileURL = URL.createObjectURL(file); saveAs(file, "invoices.pdf"); window.open(fileURL); this.pdfSrc = fileURL; this.showPdf = true; this.showSuccess('Invoices have been generated successfully.'); this.selectedRows = []; }, error => { this.showError('Invoices have not been generated successfully.'); }); generateInvoicePrinting(orders: any): Observable<any> { const url = `${environment.apiUrl}api/Order/printInvoices/pdf`; return this.http.post(url, orders, { headers: new HttpHeaders({ 'Content-Type': 'application/json' }), observe: 'response', responseType: 'blob' }).pipe( map(res => res.body), ); }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda