Sha256: bd4a6161c3c10c2411a96a49562b5c85bf1011b4fa3d54a054eb7ba03f4a606e

Contents?: true

Size: 479 Bytes

Versions: 83

Compression:

Stored size: 479 Bytes

Contents

#!/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[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

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
poppler-4.2.7 sample/pdf2svg.rb
poppler-4.2.6 sample/pdf2svg.rb
poppler-4.2.5 sample/pdf2svg.rb
poppler-4.2.4 sample/pdf2svg.rb
poppler-4.2.3 sample/pdf2svg.rb
poppler-4.2.2 sample/pdf2svg.rb
poppler-4.2.1 sample/pdf2svg.rb
poppler-4.2.0 sample/pdf2svg.rb
poppler-4.1.9 sample/pdf2svg.rb
poppler-4.1.8 sample/pdf2svg.rb
poppler-4.1.7 sample/pdf2svg.rb
poppler-4.1.6 sample/pdf2svg.rb
poppler-4.1.5 sample/pdf2svg.rb
poppler-4.1.4 sample/pdf2svg.rb
poppler-4.1.3 sample/pdf2svg.rb
poppler-4.1.2 sample/pdf2svg.rb
poppler-4.1.1 sample/pdf2svg.rb
poppler-4.1.0 sample/pdf2svg.rb
poppler-4.0.9 sample/pdf2svg.rb
poppler-4.0.8 sample/pdf2svg.rb