class DocRaptor::PrinceOptions

Attributes

baseurl[RW]

Set the baseurl for assets.

css_dpi[RW]

Set the DPI when rendering CSS. Defaults to 96 but can be set with Prince 9.0 and up.

debug[RW]

Enable Prince debug mode.

disallow_annotate[RW]

Disallow annotation of this PDF.

disallow_copy[RW]

Disallow copying of this PDF.

disallow_modify[RW]

Disallow modification of this PDF.

disallow_print[RW]

Disallow printing of this PDF.

encrypt[RW]

Encrypt PDF output.

http_password[RW]

Set the password for HTTP authentication.

http_proxy[RW]

Set the HTTP proxy server.

http_timeout[RW]

Set the HTTP request timeout.

http_user[RW]

Set the user for HTTP authentication.

iframes[RW]

Enable loading of iframes.

input[RW]

Specify the input format, defaults to html.

insecure[RW]

Disable SSL verification.

javascript[RW]

Enable PrinceXML JavaScript. DocRaptor JavaScript parsing is also available elsewhere.

key_bits[RW]

Set encryption key size.

media[RW]

Specify the CSS media type. Defaults to "print" but you may want to use "screen" for web styles.

no_author_style[RW]

Ignore author stylesheets.

no_compress[RW]

Disable PDF compression.

no_default_style[RW]

Ignore default stylesheets.

no_embed_fonts[RW]

Disable font embedding in PDFs.

no_network[RW]

Disable network access.

no_parallel_downloads[RW]

Disables parallel fetching of assets during PDF creation. Useful if your asset host has strict rate limiting.

no_subset_fonts[RW]

Disable font subsetting in PDFs.

no_xinclude[RW]

Disable XML inclusion.

owner_password[RW]

Set the PDF owner password.

page_margin[RW]

Specify the page margin distance.

pdf_forms[RW]

Make form fields editable by default.

pdf_title[RW]

Specify the PDF title, part of the document’s metadata.

profile[RW]

In Prince 9.0 and up you can set the PDF profile.

user_password[RW]

Set the PDF user password.

version[RW]

Deprecated, use the appropriate ‘pipeline` version. Specify a specific verison of PrinceXML to use.

Public Class Methods

acceptable_attributes() click to toggle source

Returns all the JSON keys this model knows about

# File lib/docraptor/models/prince_options.rb, line 179
def self.acceptable_attributes
  attribute_map.values
end
attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/docraptor/models/prince_options.rb, line 140
def self.attribute_map
  {
    :'baseurl' => :'baseurl',
    :'no_xinclude' => :'no_xinclude',
    :'no_network' => :'no_network',
    :'no_parallel_downloads' => :'no_parallel_downloads',
    :'http_user' => :'http_user',
    :'http_password' => :'http_password',
    :'http_proxy' => :'http_proxy',
    :'http_timeout' => :'http_timeout',
    :'insecure' => :'insecure',
    :'media' => :'media',
    :'no_author_style' => :'no_author_style',
    :'no_default_style' => :'no_default_style',
    :'no_embed_fonts' => :'no_embed_fonts',
    :'no_subset_fonts' => :'no_subset_fonts',
    :'no_compress' => :'no_compress',
    :'encrypt' => :'encrypt',
    :'key_bits' => :'key_bits',
    :'user_password' => :'user_password',
    :'owner_password' => :'owner_password',
    :'disallow_print' => :'disallow_print',
    :'disallow_copy' => :'disallow_copy',
    :'disallow_annotate' => :'disallow_annotate',
    :'disallow_modify' => :'disallow_modify',
    :'debug' => :'debug',
    :'input' => :'input',
    :'version' => :'version',
    :'javascript' => :'javascript',
    :'css_dpi' => :'css_dpi',
    :'profile' => :'profile',
    :'pdf_title' => :'pdf_title',
    :'iframes' => :'iframes',
    :'page_margin' => :'page_margin',
    :'pdf_forms' => :'pdf_forms'
  }
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/docraptor/models/prince_options.rb, line 469
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/docraptor/models/prince_options.rb, line 231
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `DocRaptor::PrinceOptions` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `DocRaptor::PrinceOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'baseurl')
    self.baseurl = attributes[:'baseurl']
  end

  if attributes.key?(:'no_xinclude')
    self.no_xinclude = attributes[:'no_xinclude']
  end

  if attributes.key?(:'no_network')
    self.no_network = attributes[:'no_network']
  end

  if attributes.key?(:'no_parallel_downloads')
    self.no_parallel_downloads = attributes[:'no_parallel_downloads']
  end

  if attributes.key?(:'http_user')
    self.http_user = attributes[:'http_user']
  end

  if attributes.key?(:'http_password')
    self.http_password = attributes[:'http_password']
  end

  if attributes.key?(:'http_proxy')
    self.http_proxy = attributes[:'http_proxy']
  end

  if attributes.key?(:'http_timeout')
    self.http_timeout = attributes[:'http_timeout']
  end

  if attributes.key?(:'insecure')
    self.insecure = attributes[:'insecure']
  end

  if attributes.key?(:'media')
    self.media = attributes[:'media']
  end

  if attributes.key?(:'no_author_style')
    self.no_author_style = attributes[:'no_author_style']
  end

  if attributes.key?(:'no_default_style')
    self.no_default_style = attributes[:'no_default_style']
  end

  if attributes.key?(:'no_embed_fonts')
    self.no_embed_fonts = attributes[:'no_embed_fonts']
  end

  if attributes.key?(:'no_subset_fonts')
    self.no_subset_fonts = attributes[:'no_subset_fonts']
  end

  if attributes.key?(:'no_compress')
    self.no_compress = attributes[:'no_compress']
  end

  if attributes.key?(:'encrypt')
    self.encrypt = attributes[:'encrypt']
  end

  if attributes.key?(:'key_bits')
    self.key_bits = attributes[:'key_bits']
  end

  if attributes.key?(:'user_password')
    self.user_password = attributes[:'user_password']
  end

  if attributes.key?(:'owner_password')
    self.owner_password = attributes[:'owner_password']
  end

  if attributes.key?(:'disallow_print')
    self.disallow_print = attributes[:'disallow_print']
  end

  if attributes.key?(:'disallow_copy')
    self.disallow_copy = attributes[:'disallow_copy']
  end

  if attributes.key?(:'disallow_annotate')
    self.disallow_annotate = attributes[:'disallow_annotate']
  end

  if attributes.key?(:'disallow_modify')
    self.disallow_modify = attributes[:'disallow_modify']
  end

  if attributes.key?(:'debug')
    self.debug = attributes[:'debug']
  end

  if attributes.key?(:'input')
    self.input = attributes[:'input']
  end

  if attributes.key?(:'version')
    self.version = attributes[:'version']
  end

  if attributes.key?(:'javascript')
    self.javascript = attributes[:'javascript']
  end

  if attributes.key?(:'css_dpi')
    self.css_dpi = attributes[:'css_dpi']
  end

  if attributes.key?(:'profile')
    self.profile = attributes[:'profile']
  end

  if attributes.key?(:'pdf_title')
    self.pdf_title = attributes[:'pdf_title']
  end

  if attributes.key?(:'iframes')
    self.iframes = attributes[:'iframes']
  end

  if attributes.key?(:'page_margin')
    self.page_margin = attributes[:'page_margin']
  end

  if attributes.key?(:'pdf_forms')
    self.pdf_forms = attributes[:'pdf_forms']
  end
end
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/docraptor/models/prince_options.rb, line 223
def self.openapi_nullable
  Set.new([
    :'iframes',
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/docraptor/models/prince_options.rb, line 184
def self.openapi_types
  {
    :'baseurl' => :'String',
    :'no_xinclude' => :'Boolean',
    :'no_network' => :'Boolean',
    :'no_parallel_downloads' => :'Boolean',
    :'http_user' => :'String',
    :'http_password' => :'String',
    :'http_proxy' => :'String',
    :'http_timeout' => :'Integer',
    :'insecure' => :'Boolean',
    :'media' => :'String',
    :'no_author_style' => :'Boolean',
    :'no_default_style' => :'Boolean',
    :'no_embed_fonts' => :'Boolean',
    :'no_subset_fonts' => :'Boolean',
    :'no_compress' => :'Boolean',
    :'encrypt' => :'Boolean',
    :'key_bits' => :'Integer',
    :'user_password' => :'String',
    :'owner_password' => :'String',
    :'disallow_print' => :'Boolean',
    :'disallow_copy' => :'Boolean',
    :'disallow_annotate' => :'Boolean',
    :'disallow_modify' => :'Boolean',
    :'debug' => :'Boolean',
    :'input' => :'String',
    :'version' => :'String',
    :'javascript' => :'Boolean',
    :'css_dpi' => :'Integer',
    :'profile' => :'String',
    :'pdf_title' => :'String',
    :'iframes' => :'Boolean',
    :'page_margin' => :'String',
    :'pdf_forms' => :'Boolean'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/docraptor/models/prince_options.rb, line 416
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      baseurl == o.baseurl &&
      no_xinclude == o.no_xinclude &&
      no_network == o.no_network &&
      no_parallel_downloads == o.no_parallel_downloads &&
      http_user == o.http_user &&
      http_password == o.http_password &&
      http_proxy == o.http_proxy &&
      http_timeout == o.http_timeout &&
      insecure == o.insecure &&
      media == o.media &&
      no_author_style == o.no_author_style &&
      no_default_style == o.no_default_style &&
      no_embed_fonts == o.no_embed_fonts &&
      no_subset_fonts == o.no_subset_fonts &&
      no_compress == o.no_compress &&
      encrypt == o.encrypt &&
      key_bits == o.key_bits &&
      user_password == o.user_password &&
      owner_password == o.owner_password &&
      disallow_print == o.disallow_print &&
      disallow_copy == o.disallow_copy &&
      disallow_annotate == o.disallow_annotate &&
      disallow_modify == o.disallow_modify &&
      debug == o.debug &&
      input == o.input &&
      version == o.version &&
      javascript == o.javascript &&
      css_dpi == o.css_dpi &&
      profile == o.profile &&
      pdf_title == o.pdf_title &&
      iframes == o.iframes &&
      page_margin == o.page_margin &&
      pdf_forms == o.pdf_forms
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/docraptor/models/prince_options.rb, line 500
def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = DocRaptor.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/docraptor/models/prince_options.rb, line 571
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/docraptor/models/prince_options.rb, line 476
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end
eql?(o) click to toggle source

@see the ‘==` method @param [Object] Object to be compared

# File lib/docraptor/models/prince_options.rb, line 456
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/docraptor/models/prince_options.rb, line 462
def hash
  [baseurl, no_xinclude, no_network, no_parallel_downloads, http_user, http_password, http_proxy, http_timeout, insecure, media, no_author_style, no_default_style, no_embed_fonts, no_subset_fonts, no_compress, encrypt, key_bits, user_password, owner_password, disallow_print, disallow_copy, disallow_annotate, disallow_modify, debug, input, version, javascript, css_dpi, profile, pdf_title, iframes, page_margin, pdf_forms].hash
end
input=(input) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] input Object to be assigned

# File lib/docraptor/models/prince_options.rb, line 406
def input=(input)
  validator = EnumAttributeValidator.new('String', ["html", "xml", "auto"])
  unless validator.valid?(input)
    fail ArgumentError, "invalid value for \"input\", must be one of #{validator.allowable_values}."
  end
  @input = input
end
key_bits=(key_bits) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] key_bits Object to be assigned

# File lib/docraptor/models/prince_options.rb, line 396
def key_bits=(key_bits)
  validator = EnumAttributeValidator.new('Integer', [40, 128])
  unless validator.valid?(key_bits)
    fail ArgumentError, "invalid value for \"key_bits\", must be one of #{validator.allowable_values}."
  end
  @key_bits = key_bits
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/docraptor/models/prince_options.rb, line 379
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/docraptor/models/prince_options.rb, line 547
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/docraptor/models/prince_options.rb, line 553
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/docraptor/models/prince_options.rb, line 541
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/docraptor/models/prince_options.rb, line 386
def valid?
  key_bits_validator = EnumAttributeValidator.new('Integer', [40, 128])
  return false unless key_bits_validator.valid?(@key_bits)
  input_validator = EnumAttributeValidator.new('String', ["html", "xml", "auto"])
  return false unless input_validator.valid?(@input)
  true
end