class Linkedin2CV::LatexRenderer

Public Instance Methods

render(profile, options) click to toggle source

Public: Render a LaTeX document

# File lib/linkedin2cv/renderer/latex_renderer.rb, line 7
def render(profile, options)
  output = render_latex(profile, options)
  output_filename = "#{options['output_file']}.latex"
  render_pdf(output, output_filename)
end
render_latex(profile, options) click to toggle source

Convert a LinkedIn Profile into a LaTeX source document.

# File lib/linkedin2cv/renderer/latex_renderer.rb, line 28
def render_latex(profile, options)
  require 'tilt/erb'
  template = Tilt.new('templates/cv.erb')
  output = template.render(self, :profile => profile, :options => options)
  output
end
render_pdf(output, output_filename) click to toggle source

Public: Produce a Latex PDF

# File lib/linkedin2cv/renderer/latex_renderer.rb, line 16
def render_pdf(output, output_filename)
  output_file = File.new(output_filename, 'w')
  output_file.write(output)
  output_file.close

  # Make sure this variable is escaped, clearly.....
  system("pdflatex  -output-directory=/tmp/ #{output_filename}")
end