/usr/share/doc/ruby-poppler/examples/pdf2svg.rb is in ruby-poppler 2.2.5-4build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/usr/bin/env ruby
require "poppler"
if ARGV.size < 1
puts "usage: #{$0} input.pdf"
exit(-1)
end
input, = ARGV
output = input.sub(/\..+$/, ".svg")
output = "#{output}.svg" if input == output
doc = Poppler::Document.new(input)
width, height = doc.pages[0].size
Cairo::SVGSurface.new(output, width, height) do |surface|
surface.restrict_to_version("1_2")
context = Cairo::Context.new(surface)
doc.each do |page|
page.render(context)
context.show_page
end
end
|