# Creating a PDF file at Google drive

**URL:** <https://discourse.nodered.org/t/creating-a-pdf-file-at-google-drive/84518>\
**Category:** General\
**Tags:** function-node\
**Created:** [13 January 2024 14:39 UTC](https://discourse.nodered.org/t/creating-a-pdf-file-at-google-drive/84518 "2024-01-13T14:39:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heursqem](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@Heursqem](https://discourse.nodered.org/u/Heursqem)\
**Post date:** [13 January 2024 14:39 UTC](https://discourse.nodered.org/t/creating-a-pdf-file-at-google-drive/84518/1 "2024-01-13T14:39:07Z")

</div>

Hi

I am struggling to create / save a PDF file to my Google Drive.  
I have been able to install & run [node-red-contrib-google-oauth2](https://flows.nodered.org/node/node-red-contrib-google-oauth2), this gives me access to my google account with the right permission.

I am using files.create to create a pdf file.

This is the payload I use:

> var payload = {  
> uploadType: "multipart/form-data",  
> supportsAllDrives: true,  
> resource: {  
> name: "MyPDFFile.pdf",  
> "contenType": 'application/json; charset=UTF-8'  
> },  
> media: {  
> mimeType: "application/pdf; charset=UTF-8",  
> body: msg.payload  
> },  
> }  
> msg.payload = payload;  
> return msg;

I am ending up with an empty PDF in my google drive.  
What am I doing wrong?

Thanks in advance  
Heursqem

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 January 2024 15:29 UTC](https://discourse.nodered.org/t/creating-a-pdf-file-at-google-drive/84518/2 "2024-01-13T15:29:43Z")

</div>

Not _really_ enough info to help much (for me anyhow).

> [@Heursqem](#):
>
> I am using files.create to create a pdf file.

what is "files.create"?

> [@Heursqem](#):
>
> This is the payload I use

What do you send that to?

> [@Heursqem](#):
>
> name: "MyPDFFile.pdf",

Does this file exist and where is it saved?

> [@Heursqem](#):
>
> I am ending up with an empty PDF in my google drive.

Do you have a non empty PDF somewhere created on the Node-RED server?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 January 2024 15:36 UTC](https://discourse.nodered.org/t/creating-a-pdf-file-at-google-drive/84518/3 "2024-01-13T15:36:21Z")

</div>

> [@Heursqem](#):
>
> "contenType":

Is that missing a t?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 March 2024 15:37 UTC](https://discourse.nodered.org/t/creating-a-pdf-file-at-google-drive/84518/4 "2024-03-13T15:37:03Z")

</div>

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