class Origami::XDP::Packet::PDF
An XDF pdf element encloses a PDF packet.
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/origami/xfa.rb, line 822 def initialize super("pdf") add_attribute 'xmlns', 'http://ns.adobe.com/xdp/pdf/' end
Public Instance Methods
enclose_pdf(pdfdata)
click to toggle source
# File lib/origami/xfa.rb, line 828 def enclose_pdf(pdfdata) require 'base64' b64data = Base64.encode64(pdfdata).chomp! doc = elements['document'] || add_element('document') chunk = doc.elements['chunk'] || doc.add_element('chunk') chunk.text = b64data self end
enclosed_pdf()
click to toggle source
# File lib/origami/xfa.rb, line 850 def enclosed_pdf return nil unless has_enclosed_pdf? require 'base64' Base64.decode64(elements['document/chunk'].text) end
has_enclosed_pdf?()
click to toggle source
# File lib/origami/xfa.rb, line 840 def has_enclosed_pdf? chunk = elements['document/chunk'] not chunk.nil? and not chunk.text.nil? end
remove_enclosed_pdf()
click to toggle source
# File lib/origami/xfa.rb, line 846 def remove_enclosed_pdf elements.delete('document') if has_enclosed_pdf? end