Google Document Viewer Shows No Preview

I used the Google Doc Viewer to open PDF files on my Android device. A black screen appears with the text "No preview" instead of opening my PDF files. I tested sample PDF files from Google. They work fine, but not my PDF files. Is there anything I need to do on the code side to view my PDF.

http://docs.google.com/viewer?url=myurl.pdf 

enter image description here

+6
javascript pdf
source share
2 answers

Had a file that showed this problem. Renamed it to remove spaces in the file name, updated my link, and it worked. Note that spaces were correctly encoded HTML as% 20, so this “fix” is not required. But I can not argue with success. Good luck.

+3
source share

Finally, I solved this problem. The problem is in the url. In url, I replaced% 2 with% 252, after which I solved this problem after 1 week.

In short, I want to encode a query string.

 if (Url != null && Url.contains("=")) { String Urll =Url.substring(Url.lastIndexOf("&Signature=") + 1).replace("%2B", "%252B"); if (null != Urll && Urll.length() > 0 && Urll.contains("%252B")) { int endIndex = Url.lastIndexOf("Signature"); if (endIndex != -1) { Url = Url.substring(0, endIndex); Url = Url + Urll; } } Url = Url.replace("?AWSAccessKeyId=", "?AWSAccessKeyId%3D") .replace("&Expires=", "%26Expires%3D").replace("&Signature=", "%26Signature%3D"); } 
0
source share

All Articles