Sha256: 65c0177ad40ddbfb7bfa13f776ce11ef4537fc25da4e2958b576abeabd98c511

Contents?: true

Size: 668 Bytes

Versions: 8

Compression:

Stored size: 668 Bytes

Contents

#!/usr/bin/env ruby

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

OUTPUT_FILE = "#{File.basename(__FILE__, '.rb')}.pdf"

pdf = PDF.new

50.times do |n|
    pdf.append_page do |page|
        contents = ContentStream.new
        contents.write "page #{n+1}",
            x: 250, y: 450, rendering: Text::Rendering::FILL, size: 30

        page.Contents = contents

        if n != 49
            page.onOpen Action::Named::NEXT_PAGE
        else
            page.onOpen Action::Named::FIRST_PAGE
        end
    end
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/loop/named.rb
origamindee-3.0.0 examples/loop/named.rb
origami-2.1.0 examples/loop/named.rb
origami-2.0.4 examples/loop/named.rb
origami-2.0.3 examples/loop/named.rb
origami-2.0.2 examples/loop/named.rb
origami-2.0.1 examples/loop/named.rb
origami-2.0.0 examples/loop/named.rb