0

When I run getAsPDF on the Xero side, I get a buffer output like this:

enter image description here

I am trying to convert it to base64 format and send it as pdf, but I could not convert it to pdf format.

Sahil Tariq
  • 138
  • 6
Furkan Gulsen
  • 1,384
  • 2
  • 12
  • 24

1 Answers1

1

you can pass the buffer data to Buffer object to convert data into base64.

Link: https://nodejs.org/api/buffer.html#static-method-bufferfromstring-encoding

Example:

const base64Data = Buffer.from(bufferDataGoesHere).toString("base64");

Bhairesh M
  • 72
  • 10