Class: ZPdf::HtmlPdfObject
- Inherits:
-
Object
- Object
- ZPdf::HtmlPdfObject
- Defined in:
- lib/z_pdf/html_pdf_object.rb
Instance Attribute Summary collapse
-
#html_parts ⇒ Object
Returns the value of attribute html_parts.
-
#pdf_content ⇒ Object
readonly
Returns the value of attribute pdf_content.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(html_parts = {}, params = {}) ⇒ HtmlPdfObject
constructor
A new instance of HtmlPdfObject.
- #save_to_file(filename) ⇒ Object
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_parts ⇒ Object
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_content ⇒ Object (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_path ⇒ Object
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_path ⇒ Object
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 |