How to download to server rather than client a Google drive file converted to PDF?

189 Views Asked by At

I am using "The Google Picker API" with asp.net web application to retrieve a file saved in Google drive and convert it to PDF using google export, then I want to save the PDF file to web server I am getting the download link of Google drive file converted to PDF in this format

https://docs.google.com/spreadsheets/d/**an-id-here***/export?format=pdf

The link is working fine and I'm getting the file downloaded.

But I want to save the file to my wb server using a http handler which I am calling from javascript When I send the download link to the Htpp handler, the file saved to the server is corrupted But when I use a url like this one http://www.africau.edu/images/default/sample.pdf the file is saved correctly to my web server

I'm using this code to save the pdf fil into the server

Using client = New System.Net.WebClient()
            client.DownloadFile(url, tofile)
End Using

My question is:

  • is there a way to get url for the pdf file rather then a download link
  • Or if not possible, is there a way to save the file into the web server using this download link ?
0

There are 0 best solutions below