Class: ZPdf::HtmlPdfObject
- Inherits:
-
Object
- Object
- ZPdf::HtmlPdfObject
- Defined in:
- lib/zpdf/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.
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_parts ⇒ Object
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_content ⇒ Object (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_path ⇒ Object
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_path ⇒ Object
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 |