Class: ZPdf::HtmlPdfObject

Inherits:
Object
  • Object
show all
Defined in:
lib/z_pdf/html_pdf_object.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(html_parts = {}, params = {}) ⇒ HtmlPdfObject

Returns a new instance of HtmlPdfObject.



19
20
21
22
23
# File 'lib/z_pdf/html_pdf_object.rb', line 19

def initialize(html_parts = {},params = {})
  @html_parts = html_parts
  @params = params
  @verbose = params.delete('verbose')
end

Instance Attribute Details

#html_partsObject

Returns the value of attribute html_parts.



8
9
10
# File 'lib/z_pdf/html_pdf_object.rb', line 8

def html_parts
  @html_parts
end

#pdf_contentObject (readonly)

Returns the value of attribute pdf_content.



9
10
11
# File 'lib/z_pdf/html_pdf_object.rb', line 9

def pdf_content
  @pdf_content
end

Class Method Details

.get_wkhtmltopdf_pathObject



15
16
17
# File 'lib/z_pdf/html_pdf_object.rb', line 15

def self.get_wkhtmltopdf_path
  ZPdf::Base.wkhtmltopdf_path || find_wkhtmltopdf_executable # will try to call it anyway, if it is on the path

end

.wkhtmltopdf_pathObject



11
12
13
# File 'lib/z_pdf/html_pdf_object.rb', line 11

def self.wkhtmltopdf_path
  @@wkhtmltopdf_path ||= get_wkhtmltopdf_path
end

Instance Method Details

#save_to_file(filename) ⇒ Object



33
34
35
# File 'lib/z_pdf/html_pdf_object.rb', line 33

def save_to_file(filename)
  File.open(filename,'wb') { |f| f.write(pdf_content) }
end