Application/pdf received, trying to send it via attachData

I’m using axios to request a PDF file, and, as I see, it’s well received.

Now I want to send the pdf attached in a mail to a user, and I’m getting a blank pdf when i’m doing:

.attachData(dte_pdf.data, "boleta_"+folio+".pdf")

well, dte_pdf. data looks like this when I console.log(utils.inspect(dte_pdf.data)):

Can you set the contentType header as well.

.attachData(dte_pdf.data, "boleta_"+folio+".pdf", {
      {
	     contentType: "application/pdf",
      }
})
2 Likes

Using this, i’m still receiving blank pdf at the email… Do you recommend maybe another module not axios for doing the request for the pdf to do a test? or any ideas?
Thank you in advance!

First I suggest writing the buffer to a file to see if it’s generating a valid PDF or not