unludo
unludo

Reputation: 5010

Displaying a file created through Google Drive API with the Google Drive Viewer

I am able to create a document through the google drive api.

I get back some urls:

https://docs.google.com/document/d/xxxsome_idxxxxx/edit?usp=drivesdk

https://docs.google.com/document/d/xxxsome_idxxxxx/preview

I would like to display the created document thanks to the google document viewer, like it is done here : http://architects.dzone.com/articles/embedding-google-docs-and

The problem is that I can't have the document to open in the viewer with the above URLs.

I also tried to publish the document directly from google drive (menu file > publish to the web...). The url is something like:

Again the file cannot render in the viewer.

Would someone know how to do this, i.e. having the viewer showing, in pdf mode, a document created in the drive from the api ?

Thanks!

Upvotes: 0

Views: 1901

Answers (1)

vishesh
vishesh

Reputation: 2045

You can convert the document to pdf and then pass pdf url to google document viewer. In fact you won't have to do any hard work for that. With the file object google gives embed links, one of them will be of pdf. Just pass this pdf link to google viewer.

Upvotes: 1

Related Questions