Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Docs inline pdf shows up as black and white

I am embedding pdfs(hosted at S3) in modals using the google docs iframe in my rails app. Here's the code:

$modalBody.append(
  "<iframe src='https://docs.google.com/viewer?url=<%= @url %>&embedded=true' width='100%' height='800'></iframe>"
);

The issue is that sometimes(seemingly random) the pdfs show up in black and white even though the original upload was in color. The only hint I have is that the pdfs that render as black and white generally have very little color in them(like the one below). Any idea what's going on?

AWS

AWS pdf link

screenshot of pdf

Google Docs

Google Docs link (You can get this by plugging the AWS link into Google Docs viewer)

google docs screenshot

like image 956
Josh Avatar asked Feb 12 '14 19:02

Josh


1 Answers

I believe it is the compression type of the RGB image in the PDF. I tried converting the RGB to CMYK which sort-of-works (I only have a really old utility for doing this). I also tried editing the original to add another image: http://tonywilk.no-ip.org/testpdf/index.html the pdf file is at: http://tonywilk.no-ip.org/testpdf/test_out.pdf

This shows the colour for the added image with the original still monochrome - so Google viewer cannot handle the original's compression type.

Other than re-encoding the pdf's, I'm afraid it does not help you much - sorry !

like image 115
TonyWilk Avatar answered Oct 23 '22 00:10

TonyWilk