Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Google Viewer Doc, to show pdf's, but when I try show a pdf stored in my LocalHost it says, "Sorry, we were unable to find the document..."

This is my code.

<iframe src="http://docs.google.com/viewer?url=http://localhost/CardMarte/Documents/Datacode-VISA.pdf&embedded=true" frameborder="1" style="width: 100px; height: 550px;" id="ctIframe"  runat="server">
</iframe>


What I have to do to display my pdf correctly?
Posted
Updated 6-Jan-14 17:03pm
v3
Comments
Valery Possoz 6-Jan-14 19:16pm    
I guess some server at google must be able to load your file to display it. LocalHost is visible to you only, you should provide a public URL rather than a local one.
ZurdoDev 6-Jan-14 21:39pm    
I believe this is the solution. You should post it as such.

1 solution

As Valery Possoz posted in your comment, you can't.

Google Docs works by loading a document from a URL. Localhost is only available to your local computer, not to the outside world. Google can't access your computer and load the document from the localhost URL.

There are some ways you can get around this, like using a Dynamic DNS (DynDNS for example[^]). This will require you to install a client on your computer that updates a DNS entry. You then use the dynamic dns name to refer to your computer and the location of your file. This may also require some complicated setup with your router or modem to allow HTTP traffic to pass to the right computer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900