Class: DynamicPDFApi::GoToAction

Inherits:
Action
  • Object
show all
Defined in:
lib/ruby_client/GoToAction.rb

Overview

Represents a goto action in a PDF document that navigates to a specific page using page number and zoom options.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input, page_offset = 0, page_zoom = PageZoom::FIT_PAGE) ⇒ GoToAction

Initializes a new instance of the GoToAction class using an input to create the PDF, page number, and a zoom option.

Parameters:

  • input (Input)

    Any of the ImageInput, DlexInput, PdfInput or PageInput objects to create PDF.

  • page_offset (int) (defaults to: 0)

    Page number to navigate.

  • page_zoom (String) (defaults to: PageZoom::FIT_PAGE)

    PageZoom to display the destination.



19
20
21
22
23
24
25
# File 'lib/ruby_client/GoToAction.rb', line 19

def initialize(input, page_offset = 0, page_zoom = PageZoom::FIT_PAGE)
  super()
  @_input = input
  @_input_id = input.id
  @page_offset = page_offset
  @page_zoom = page_zoom
end

Instance Attribute Details

#_inputObject

Returns the value of attribute _input.



27
28
29
# File 'lib/ruby_client/GoToAction.rb', line 27

def _input
  @_input
end

#_input_idObject

Returns the value of attribute _input_id.



27
28
29
# File 'lib/ruby_client/GoToAction.rb', line 27

def _input_id
  @_input_id
end

#page_offsetObject

Gets or sets page Offset.



32
33
34
# File 'lib/ruby_client/GoToAction.rb', line 32

def page_offset
  @page_offset
end

#page_zoomObject

Gets or sets PageZoom to display the destination.



37
38
39
# File 'lib/ruby_client/GoToAction.rb', line 37

def page_zoom
  @page_zoom
end

Instance Method Details

#to_json(_options = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ruby_client/GoToAction.rb', line 39

def to_json(_options = {})
  json_array = {}

  json_array['input'] = @_input unless @_input.nil?

  json_array['inputID'] = @_input_id unless @_input_id.nil?

  json_array['pageOffset'] = @page_offset unless @page_offset.nil?

  json_array['pageZoom'] = @page_zoom unless @page_zoom.nil?

  JSON.pretty_generate(json_array)
end