Sha256: 5513479fc7cc5b089c0a3b4d01d47ef9ab00e4f1cde2c98879de529d07febc7b

Contents?: true

Size: 869 Bytes

Versions: 8

Compression:

Stored size: 869 Bytes

Contents

#!/usr/bin/env ruby

begin
    require 'origami'
rescue LoadError
    $: << File.join(__dir__, "../../lib")
    require 'origami'
end
include Origami

#
# Embeding a Flash asset inside a PDF document.
#

SWF_PATH = File.join(__dir__, "helloworld.swf")
OUTPUT_FILE = "#{File.basename(__FILE__, ".rb")}.pdf"

# Creating a new file
pdf = PDF.new

# Embedding the SWF file into the PDF.
swf = pdf.attach_file(SWF_PATH)

# Creating a Flash annotation on the page.
pdf.append_page do |page|
    annot = page.add_flash_application(swf,
                                       windowed: true,
                                       navigation_pane: true,
                                       toolbar: true)

    # Setting the player position on the page.
    annot.Rect = Rectangle.new [204, 573, 403, 718]
end

pdf.save(OUTPUT_FILE)

puts "PDF file saved as #{OUTPUT_FILE}."

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
origamindee-3.1.0 examples/flash/flash.rb
origamindee-3.0.0 examples/flash/flash.rb
origami-2.1.0 examples/flash/flash.rb
origami-2.0.4 examples/flash/flash.rb
origami-2.0.3 examples/flash/flash.rb
origami-2.0.2 examples/flash/flash.rb
origami-2.0.1 examples/flash/flash.rb
origami-2.0.0 examples/flash/flash.rb