Class: Md2Pdf::BackGrounder

Inherits:
Struct
  • Object
show all
Defined in:
lib/md2pdf/converter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#background_pathObject

Returns the value of attribute background_path

Returns:

  • (Object)

    the current value of background_path



20
21
22
# File 'lib/md2pdf/converter.rb', line 20

def background_path
  @background_path
end

#shellObject

Returns the value of attribute shell

Returns:

  • (Object)

    the current value of shell



20
21
22
# File 'lib/md2pdf/converter.rb', line 20

def shell
  @shell
end

#temp_filename_creatorObject

Returns the value of attribute temp_filename_creator

Returns:

  • (Object)

    the current value of temp_filename_creator



20
21
22
# File 'lib/md2pdf/converter.rb', line 20

def temp_filename_creator
  @temp_filename_creator
end

#wrapped_converterObject

Returns the value of attribute wrapped_converter

Returns:

  • (Object)

    the current value of wrapped_converter



20
21
22
# File 'lib/md2pdf/converter.rb', line 20

def wrapped_converter
  @wrapped_converter
end

Instance Method Details

#convert(input_filename, output_filename) ⇒ Object



21
22
23
24
# File 'lib/md2pdf/converter.rb', line 21

def convert(input_filename, output_filename)
  wrapped_converter.convert(input_filename, temp_filename)
  shell.exec("pdftk #{temp_filename} multibackground #{background_path} output #{output_filename}")
end

#temp_filenameObject



25
26
27
# File 'lib/md2pdf/converter.rb', line 25

def temp_filename
  @temp_filename ||= temp_filename_creator.create_file_name
end