How to generate preview of documents saved in goog

2019-02-15 03:14发布

问题:

I am trying trying to create a preview of a document saved in google drive using google viewer with -

https://docs.google.com/viewer?authuser=0&srcid={some document id}&pid=explorer&a=v&chrome=false&embedded=true

Unfortunately it only works for pdf files. The other important point is that I want to do it without making the uploaded document public.

回答1:

For get PDF file preview you can use below link :

https://lh3.google.com/u/0/d/]{FILEID}=w200-h150-p-k-nu-iv1

for example : https://lh3.google.com/u/0/d/0BwVBMmQvtcsJUkNSVFllbjRLMzZab0haTEtLajE1M2haekZj=w200-h150-p-k-nu-iv1



回答2:

Drive/docs only supports importing of Word documents, as I understand, it doesn't support previewing on them in their native form. So you would have to use the Google Documents List API to import and convert them to the native Google Document text format. The problem with this is that you don't get a round-trip (you can't reopen that document in Word). The only real option here is to export as pdf from word and save that. And if you want the general public to be able to preview it, making it public is the only solution. I don't think the technologies you're using match the problem you're trying to solve...



回答3:

Try using this URL for PDF: http://docs.google.com/viewer?url=https%3A%2F%2Fdocs.google.com%2Fuc%3Fexport%3Ddownload%26id%3D{fileID}&embedded=true

and this URL for other files: https://docs.google.com/viewer?url=https%3A%2F%2Fdocs.google.com%2Fdocument%2Fd%2F{fileID}%2Fexport%3Fformat=pdf&embedded=true

Keep in mind that files should be public.