Method: WikiController#pdf

Defined in:
app/controllers/wiki.rb

#pdfObject



623
624
625
626
627
628
629
630
631
632
# File 'app/controllers/wiki.rb', line 623

def pdf
  page = wiki.read_page(web_address, page_name)
  safe_page_name = page.name.gsub(/\W/, "")
  file_name = "#{safe_page_name}-#{web.address}-#{page.created_at.strftime("%Y-%m-%d-%H-%M")}"
  file_path = File.join EXPORT_DIRECTORY, file_name

  export_page_to_tex(file_path + ".tex") unless FileTest.exists?(file_path + ".tex")
  convert_tex_to_pdf(file_path + ".tex")
  send_export(file_name + ".pdf", file_path + ".pdf")
end