Google document preview error for large files

885 views Asked by At
Whoops!
There was a problem previewing this document.

I was trying to embed google viewer to preview pdf files uploaded into my application

(function($) {
    $.fn.gdocsViewer = function(options) {

        var settings = {
            width: '600',
            height: '700'
        };

        if (options) {
            $.extend(settings, options);
        }

        return this.each(function() {
            var file = $(this).attr('href');
            var ext = file.substring(file.lastIndexOf('.') + 1);

            $(this).after(function() {
                var id = $(this).attr('id');
                var gdvId = (typeof id !== 'undefined' && id !== false) ? id + '-gdocsviewer' : '';
                return '<div id="' + gdvId + '" class="gdocsviewer"><iframe src="https://docs.google.com/viewer?embedded=true&url=' + encodeURIComponent(file) + '" width="' + settings.width + '" height="' + settings.height + '" style="border: none;margin : 0 auto; display : block;"></iframe></div>';
            })

        });
    };
})(jQuery);

This works fine for small size files. But showing the error when I try with files with 6mb.

Why does it happen? How to solve it?

Is there a way to limit the preview page limit?

0

There are 0 answers