Class: ZPdf::HtmlPdfObject

Inherits:
Object
  • Object
show all
Defined in:
lib/zpdf/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.



18
19
20
21
22
# File 'lib/zpdf/html_pdf_object.rb', line 18

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.



7
8
9
# File 'lib/zpdf/html_pdf_object.rb', line 7

def html_parts
  @html_parts
end

#pdf_contentObject (readonly)

Returns the value of attribute pdf_content.



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

def pdf_content
  @pdf_content
end

Class Method Details

.get_wkhtmltopdf_pathObject



14
15
16
# File 'lib/zpdf/html_pdf_object.rb', line 14

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



10
11
12
# File 'lib/zpdf/html_pdf_object.rb', line 10

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

Instance Method Details

#save_to_file(filename) ⇒ Object



32
33
34
# File 'lib/zpdf/html_pdf_object.rb', line 32

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