Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created May 30, 2009 09:10
Show Gist options
  • Select an option

  • Save practicingruby/120455 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/120455 to your computer and use it in GitHub Desktop.
require "java"
require "rubygems"
require "flying_saucer"
pdf_file = java.io.File.new(ARGV[0].sub(/html$/,"pdf"))
renderer = org.xhtmlrenderer.pdf.ITextRenderer.new
renderer.set_document(java.io.File.new(ARGV[0]))
renderer.layout
renderer.createPDF(java.io.FileOutputStream.new(pdf_file), true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment