How to display pdf


I’m building a custom node that downloads pdf files and I don’t know what I’m doing wrong because it comes as a string looking like this

And in postman it downloads it as it should, and it displays it as a pdf file.
I would like to node to output the file as a file and not as a string.
Am I missing something?
Thank you,

Hi Andrej,

if you are using HTTP Request node, you can force the result to “file” so you get the binary.

Your output looks like base64 encoded.

  • Kurt
1 Like

That’s the thing, I don’t wanna use a HTTP Request node, it’s a custom made node that gets a file as a response. I tried this " returnData.push(Buffer.from(responseData, ‘base64’))" in the node, but now I get this:

Can you send me the output via PM if its not confidential. Maybe I can figure out how to deal with it

  • Kurt
1 Like

Hi @kje,

We have the same request performed by http node, which returns the file response correctly:

Our node output:

Code for our operation:

        let responseData;
		const returnData = [];

if (operation === 'downloadDocument') {
					const documentID = this.getNodeParameter('documentID', i) as string;
					const options: OptionsWithUri = {
						headers: {
							Accept: 'application/pdf',
						method: 'GET',
						body: {},
						uri: `https://${tenant}.${server}/v1/document/id/${documentID}/download`,
						json: true,

					responseData = await

return [this.helpers.returnJsonArray(returnData)];

We can see here that http request node returns the file in the Binary form. Also, it is possible to download it and view it. How can we adjust our node to output the binary file correctly like the http request node?

Hi @alexnemes,

you can use Move Binary Data node to convert the PDF (delivered as Text from your code) into a binary file. To make it downloadable you have to set a filename in addition to the binary data.

  • Kurt