Sha256: 072d2778b3f6abadeda684b22439290b708e5fb329cb946384e2047bd39be0ed

Contents?: true

Size: 485 Bytes

Versions: 145

Compression:

Stored size: 485 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.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

Version data entries

145 entries across 145 versions & 1 rubygems

Version Path
poppler-3.1.8-x64-mingw32 sample/pdf2svg.rb
poppler-3.1.8-x86-mingw32 sample/pdf2svg.rb
poppler-3.1.8 sample/pdf2svg.rb
poppler-3.1.7-x64-mingw32 sample/pdf2svg.rb
poppler-3.1.7-x86-mingw32 sample/pdf2svg.rb
poppler-3.1.7 sample/pdf2svg.rb
poppler-3.1.6-x64-mingw32 sample/pdf2svg.rb
poppler-3.1.6-x86-mingw32 sample/pdf2svg.rb
poppler-3.1.6 sample/pdf2svg.rb
poppler-3.1.5-x64-mingw32 sample/pdf2svg.rb
poppler-3.1.5-x86-mingw32 sample/pdf2svg.rb
poppler-3.1.4-x64-mingw32 sample/pdf2svg.rb
poppler-3.1.4-x86-mingw32 sample/pdf2svg.rb
poppler-3.1.4 sample/pdf2svg.rb
poppler-3.1.3-x64-mingw32 sample/pdf2svg.rb
poppler-3.1.3-x86-mingw32 sample/pdf2svg.rb
poppler-3.1.3 sample/pdf2svg.rb
poppler-3.1.2-x64-mingw32 sample/pdf2svg.rb
poppler-3.1.2-x86-mingw32 sample/pdf2svg.rb
poppler-3.1.2 sample/pdf2svg.rb