File: link.rb

package info (click to toggle)
ruby-cairo 1.17.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,532 kB
  • sloc: ruby: 11,997; ansic: 10,183; sh: 48; makefile: 4
file content (19 lines) | stat: -rwxr-xr-x 481 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env ruby

top = File.expand_path(File.join(File.dirname(__FILE__), ".."))
$LOAD_PATH.unshift File.join(top, "ext", "cairo")
$LOAD_PATH.unshift File.join(top, "lib")

require "cairo"

width = 200
height = 200

Cairo::PDFSurface.new("link.pdf", width, height) do |surface|
  Cairo::Context.new(surface) do |context|
    context.move_to(50, 50)
    context.tag(Cairo::Tag::LINK, "uri='http://rcairo.github.io/'") do
      context.show_text("rcairo site")
    end
  end
end