Class: Com::PdfsController

Inherits:
BaseController show all
Defined in:
app/controllers/com/pdfs_controller.rb

Constant Summary

Constants included from RailsCom::Application

RailsCom::Application::LOCALE_MAP

Instance Method Summary collapse

Methods included from RailsCom::Application

#current_title, #default_form_params, #default_params, #json_format?, #set_country, #set_flash, #set_locale, #set_timezone, #set_variant

Instance Method Details

#jpgObject



17
18
19
20
21
22
# File 'app/controllers/com/pdfs_controller.rb', line 17

def jpg
  require 'vips'
  buffer = Vips::Image.pdfload_buffer @pdf.render

  send_data buffer.write_to_buffer('.jpg'), filename: 'cert_file.jpg', disposition: @disposition, type: 'image/jpg'
end

#pngObject



10
11
12
13
14
15
# File 'app/controllers/com/pdfs_controller.rb', line 10

def png
  require 'vips'
  buffer = Vips::Image.pdfload_buffer @pdf.render

  send_data buffer.write_to_buffer('.png'), filename: 'cert_file.png', disposition: @disposition, type: 'image/png'
end

#showObject



6
7
8
# File 'app/controllers/com/pdfs_controller.rb', line 6

def show
  send_data @pdf.render, filename: 'cert_file.pdf', disposition: @disposition, type: 'application/pdf'
end