UPDATE 2016-11-16 9:53am EST
It appears many people are still seeing 204 responses even though Google has claimed to have \"fixed\" the problem. Wh
I was using the Google Viewer as a copy viewer for our internal management system, we generally only upload PDF's and image files, so as a all-in-one solution is was brilliant, worked across the board (mobile, desktop etc). However with it becoming increasingly unreliable, I got creative.
My solution was to generate and save a JPG version of the PDF using imagick if it was viewed after being uploaded. Rather than batching all of the uploaded PDFs, they are only converted when they are accessed.
My reasoning for that is:
Once the file has been viewed and a jpg version of the pdf created, it is used in place of the PDF whenever it is viewed by a user. Not pretty but certainly works, I admit there is an element of doubling up however I do not have any storage limitations. The original file is also not modified in anyway so it serves as a tertiary remote backup too. This is not by design, but a happy coincidence.
Feel free to use the code below if it's useful to you. There are probably more elegant ways to do this, but for my purposes and users it's fine.
$_thumbnail = 'files/thumbnails/'.$_section.'/'.$_fileName.'.jpg';
if (!file_exists($_thumbnail)) {
$_file = 'files/'.$_section.'/'.$_fileName;
$imagePreview = new imagick();
$imagePreview->setResolution(300, 300);
$imagePreview->readimage($_file);
$imagePreview->setImageFormat( "jpg" );
$imagePreview->writeImage('files/thumbnails/'.$_section.'/'.$_fileName.'.jpg');
echo '
';
} else {
echo '
';
}