Method: Pdfcrowd::HtmlToImageClient#setCustomJavascript

Defined in:
lib/pdfcrowd.rb

#setCustomJavascript(custom_javascript) ⇒ Object

Run a custom JavaScript after the document is loaded and ready to print. The script is intended for post-load DOM manipulation (add/remove elements, update CSS, ...). In addition to the standard browser APIs, the custom JavaScript code can use helper functions from our JavaScript library.

  • custom_javascript - A string containing a JavaScript code. The string must not be empty.
  • Returns - The converter object.


2538
2539
2540
2541
2542
2543
2544
2545
# File 'lib/pdfcrowd.rb', line 2538

def setCustomJavascript(custom_javascript)
    if (!(!custom_javascript.nil? && !custom_javascript.empty?))
        raise Error.new(Pdfcrowd.create_invalid_value_message(custom_javascript, "custom_javascript", "html-to-image", "The string must not be empty.", "set_custom_javascript"), 470);
    end
    
    @fields['custom_javascript'] = custom_javascript
    self
end