I have a website built with Joomla that shows documents using Google’s document viewer. The site requires users to log in to see the files, but these PDF files can still be accessed directly through URLs like http://mysite.com/documents/report.pdf without logging in.
When I try to display documents through Google’s viewer using this format: docs.google.com/viewer?url=http://mysite.com/documents/report.pdf
Smaller files under 100kb work fine and display correctly. However, larger files show this timeout error:
Sorry, it took too long to find the document at the original source. Please try again later. You can also try to download the original document by clicking here.
I’m not sure if this problem comes from Google’s viewer service, my Joomla setup, or server timeout settings. What can I do to make all PDF files display properly in Google Docs viewer regardless of their file size?
That timeout happens because Google’s viewer can’t fetch larger files fast enough. I’ve dealt with this before - it’s usually your server response time, not the file size that’s the real problem. Try enabling compression and tweaking your hosting timeout settings first. You could also set up a reverse proxy or cache just for your document folder. What worked for me was splitting big PDFs into smaller chunks, or switching to PDF.js for anything over a certain size threshold.
Had this exact problem two years ago on a client project. It’s not your server config - Google’s viewer just has tight timeout limits for external docs, and big PDFs take too long to fetch and process. I fixed it with a two-tier setup: Google viewer for smaller files, but anything over 200kb gets served directly with the right HTTP headers for inline viewing. Most browsers handle PDFs natively now anyway. Just detect file size server-side and pick your display method from there. Also check if your host throttles bandwidth on direct file access - that’ll make Google’s fetch even slower.
hey! totally feel u on that. large pdfs can be a pain with google viewer. switching to a CDN or hosting on Google Drive might help prevent those timeout issues. hope this helps!