FreeAgent pdf to OneDrive

I have a FreeAgent api call module that saves a FreeAgent invoice as pdf. This outputs in base64. I am then trying to upload a file into OneDrive using the previous content to create a .pdf file. The file is created as expected but it cant be opened. I suspect there is an issue with the coding/format of the pdf output from FreeAgent.
How do I know what the correct pdf format should be for creating a file in OneDrive? Do I need to do some kind of hash translation?


As you wish to upload the file to Onedrive and the source is sending the file in Base64, Iā€™d suggest you convert the file to Binary data first and then upload it to Onedrive.

You can use the toBinary() function to convert to Binary data and then upload the binary data to Onedrive.