Skip to content

Instantly share code, notes, and snippets.

@izazueta
Last active July 20, 2023 09:32
Show Gist options
  • Save izazueta/4961650 to your computer and use it in GitHub Desktop.
Save izazueta/4961650 to your computer and use it in GitHub Desktop.
Google Docs Viewer & Office Web Apps Viewer

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
  • Microsoft Excel (.XLS and .XLSX)
  • Microsoft PowerPoint (.PPT and .PPTX)
  • Adobe Portable Document Format (.PDF)
  • Apple Pages (.PAGES)
  • Adobe Illustrator (.AI)
  • Adobe Photoshop (.PSD)
  • Tagged Image File Format (.TIFF)
  • Autodesk AutoCad (.DXF)
  • Scalable Vector Graphics (.SVG)
  • PostScript (.EPS, .PS)
  • TrueType (.TTF)
  • XML Paper Specification (.XPS)
  • Archive file types (.ZIP and .RAR)

Google Docs Viewer (Apps)

https://docs.google.com/a/[DOMINIO]/viewer?url=[FILE_URL]

Google Docs Viewer

https://docs.google.com/a/[DOMINIO]/viewer?url=[FILE_URL]

##Office Web Apps Viewer ('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

Pantalla completa

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

Incrustado dentro de un 'iframe'

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

Info: http://www.labnol.org/internet/google-docs-viewer-alternative/

@hnarun
Copy link

hnarun commented Jul 28, 2017

how can I view document from website that use iframe?
I tested with https://docs.google.com/viewer?url, but instead of viewing my file it viewed my html code.
What wrong with that?

@udara86
Copy link

udara86 commented Aug 9, 2017

Samething happened to me..I tested with https://docs.google.com/viewer?url, but instead of viewing my file it viewed my html code.
What wrong with that?

@surajmsakhare
Copy link

When user will scroll down to bottom of the page then how do I give any alert message.
Currently, I am using an iframe to show google docs viewer on my website, but I have to apply some javascript event after a complete reading of the document.

@StarWar
Copy link

StarWar commented Jan 3, 2018

Is there any bandwidth limit, if I use google drive this way?

@akira32chen
Copy link

I tried the pdf in my office unsuccessfully. The pdf is in the webserver of 192.168.1.1 shared by IIS. But I use the URL as below, the google chrome appear the error message "No preview available"。Does somebody know how to solve this problem?

https://docs.google.com/a/192.168.1.1/viewer?url=http://192.168.1.1/mypdf/aaa/pdf

@Aarbel
Copy link

Aarbel commented Feb 19, 2018

Hi ! Do you know alternatives to provide a .docx or .xlsx viewer (and maybe editor) on our own interfaces ? Like opensource libraries and editors, thanks !

@stephanebruckert
Copy link

@akira32chen you are using a local IP address which is unknown to Google

@martinhayon
Copy link

Hello, what about security? If the documents are private of a client. What happens when we put them in a web folder, so that the Google service has access.

@Tarak1246
Copy link

If i give local url, it shows no preview available...why?

@imraanparker
Copy link

Local URL's will not work as docs.google.com's servers must be able to access the document over the internet.

@zqdevelopment
Copy link

zqdevelopment commented May 24, 2021

hello, I use this API but it is don't work for this formats:
.TTF (no)
.XPS (no)
.ZIP (no)
.RAR (no)
.PNG (no)
.GIF (no)
.WebM (no)
.MPEG4 (no)
.3GPP (no)
.MOV (no)
.AVI (no)
.WMV (no)
.FLV (no)
I will be grateful for any recommendation, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment