Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

372
Visualizações
What do I have to do in order to print Blob data types (PDF) retrieved from a webserver in Node?

I don't understand how to handle Blob-Files. I have an Electron application where I retrieve a pdf from a webserver. I want to silently print the pdf retrieved from the webserver using the printer name stored in printer. I tried different solutions including different node modules but it does not work and I am not quite getting what to do. I would appreciate your help!

axios.get("getPdf", {responseType: "blob",headers: {'Accept': 'application/pdf'}).then(res => {
    let printer = printer_settings["printFormatX"];
    // I am not quite sure what to do now
    // I used different modules like 'pdf-to-printer' but it is not working like expected
    // I am generally unsure what to do with the retrieved pdf in order to print it
})
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I solved it this way: I create a temporary file, then write the response data to it in order to then print it with the module pdf-to-printer

axios.get("getPdf", {responseType: "arraybuffer",headers: {'Accept': 'application/pdf'}).then(res => {
    let printer = printer_settings["printFormatX"];
    let tmpFile = __dirname + "/tmp_pdf.pdf"
    fs.writeFileSync(tmpFile, res.data, {encoding: "binary"});
    print(tmpFile, res.data, {printer: printer});
})
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda