Using http node to convert pdf to png using API from

I am trying to send a pdf that is stored on Google drive to the pdf to png API from PSPDFKIT. I have been able to use Postman to send the POST request successfully. Here’s the cURL code Postman generated:
curl --location ‘
–header ‘Authorization: Bearer pdf_live_thisiswheretheapikeygoes’
–header ‘Cookie: AWSALB=gpNId5MPgPVt4swQBvkoAMA5AXR+1ohcD7DMIXFbO7d3+Gt52FfaGXreGx7txLeC0eK0N1wZtB/Eu2uklXRq0KGfGQ/vHKYrntQbBikCO+MvNzjwJ+tplaCjbIJQ; AWSALBCORS=gpNId5MPgPVt4swQBvkoAMA5AXR+1ohcD7DMIXFbO7d3+Gt52FfaGXreGx7txLeC0eK0N1wZtB/Eu2uklXRq0KGfGQ/vHKYrntQbBikCO+MvNzjwJ+tplaCjbIJQ’
–form ‘instructions=“{
"parts": [
{ "file": "document" }
"output": {
"type": "image",
"format": "png",
"dpi": 500
–form ‘document=@“/C:/Users/pedro/Downloads/document.pdf”’
When I import this in the Http node , it sets up the header and cookies, but not the body and the request fails. I have tried to send the body and setup the different parameters using JSON, form-data, n8n binary form, etc to no avail.
Does anyone have any example on how to accomplish this?
Thank you very much in advance.

HI @Pedro_Valladares, welcome to the community :tada:

This request includes a reference to a file on your local hard drive (/C:/Users/pedro/Downloads/document.pdf) which n8n won’t be able to access.

In n8n, you would instead download the file directly from Google Drive before sending it to another API. Now I don’t have access to pspdfkit, but a simple example workflow could look like so:

With this approach, my Google Drive file arrives at the receiving API as it should (I tested this using

If instead of using Google Drive you want to read the binary file from your local filesystem, you could use the Read Binary Files node in n8n (provided n8n runs on your local machine rather than a remote web server).

Hope this helps!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.