Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Buffer to base64 format for pdf

enter image description here

When I run getAsPDF on the Xero side, I get a buffer output like this. I am trying to convert it to base64 format and send it as pdf, but I could not convert it to pdf format.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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");

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading