Method: Origami::PDF#onDocumentClose

Defined in:
lib/origami/catalog.rb

#onDocumentClose(action) ⇒ Object

Sets an action to run on document closing.

action

A JavaScript Action Object.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/origami/catalog.rb', line 80

def onDocumentClose(action)
    unless action.is_a?(Action::JavaScript) or action.is_a?(Reference)
        raise TypeError, "An Action::JavaScript object must be passed."
    end

    unless self.Catalog
        raise InvalidPDFError, "A catalog object must exist to add this action."
    end

    self.Catalog.AA ||= CatalogAdditionalActions.new
    self.Catalog.AA.WC = action

    self
end