Giter Club home page Giter Club logo

Comments (8)

gimite avatar gimite commented on August 17, 2024

download_to_file uses different API, and it seems it only supports downloading as HTML.
To download as PDF, you need to write code to fetch the URL you mentioned manually. You can probably use session.request() method to reuse the authorization google-drive-ruby provides.

It would be nice to have that feature in google-drive-ruby. But the API google-drive-ruby uses (Document List API) will be deprecated, so I need to switch to Google Drive API. So I will implement that feature after the switch (if it's available in Google Drive API).

from google-drive-ruby.

fguillen avatar fguillen commented on August 17, 2024

I don't understand why this issue is closed when it still remains. It looks like it is solved, I suggest to keep it open so is noticed there is still someone working on it.

from google-drive-ruby.

gimite avatar gimite commented on August 17, 2024

This issue is not closed.

from google-drive-ruby.

fguillen avatar fguillen commented on August 17, 2024

You're right, my fault, I was seeing the "Closed" tag in the comments making reference to duplicate issues and I was confused, sorry.

from google-drive-ruby.

fguillen avatar fguillen commented on August 17, 2024

Please, can someone provide a working example of a workaround for this custom export?

I'm trying but I'm not able to be success. For example, this document has public access:

Following this url you can download it:

If I try to do it using session.request() I obtain an empty Nokogiri::XML::Document:

r = session.request(:get, "https://docs.google.com/feeds/download/documents/export/Export?id=12nB8pHtphQ_OaluOQdgMub9M1XFCSpiIbW4p7o53nm8&exportFormat=txt")
r.inspect
=> "#<Nokogiri::XML::Document:0x3fff1a04b8a8 name=\"document\">" 

And I don't know how to actually get the content of the file

from google-drive-ruby.

simontesar avatar simontesar commented on August 17, 2024

You need no pass another parameter, look at #64 .

from google-drive-ruby.

fguillen avatar fguillen commented on August 17, 2024

Thanks @simontesar it works:

r = session.request(:get, "https://docs.google.com/feeds/download/documents/export/Export?id=12nB8pHtphQ_OaluOQdgMub9M1XFCSpiIbW4p7o53nm8&exportFormat=txt", :response_type => :raw)
puts r # => Hello

from google-drive-ruby.

gimite avatar gimite commented on August 17, 2024

It was fixed in google_drive 1.0.0. I confirmed that Google Document -> .pdf and .docx works. You need to use export_as_file method.

from google-drive-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.