PDFサムネイル
  require 'poppler'
  require 'cairo'
  
  document = Poppler::Document.new("sample.pdf")
  page = document[0]
  
  scale = 0.25
  width, height = page.size.collect {|x| x * scale}
  
  surface = Cairo::ImageSurface.new(width, height)
  context = Cairo::Context.new(surface)
  context.scale(scale, scale)
  context.render_poppler_page(page)
  surface.write_to_png("/tmp/thumbnail.png")