Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit. The plan is to add back the functionality that was or…

…iginally in my Merb in Action builder in a more OSS-friendly reusable way.
  • Loading branch information...
commit 24685fa30aa502c1a29b56ca1b5ecbd43bdc992a 0 parents
Yehuda Katz authored
4 .gitignore
@@ -0,0 +1,4 @@
+vendor/gems/*
+!vendor/gems/cache/
+bin
+.DS_Store
2  Gemfile
@@ -0,0 +1,2 @@
+gem "maruku"
+disable_system_gems
BIN  lib/flying_saucer/jars/core-renderer.jar
Binary file not shown
BIN  lib/flying_saucer/jars/itext.jar
Binary file not shown
18 lib/flying_saucer/rufo.rb
@@ -0,0 +1,18 @@
+require "java"
+require "stringio"
+
+require "flying_saucer/jars/itext"
+require "flying_saucer/jars/core-renderer"
+import org.xhtmlrenderer.pdf.ITextRenderer
+
+java.lang.System.set_property("java.awt.headless", "true")
+
+class ITextRenderer
+ def make_pdf(input)
+ io = StringIO.new
+ set_document_from_string input
+ layout
+ create_pdf(io.to_outputstream)
+ io.string
+ end
+end
12 lib/muse.rb
@@ -0,0 +1,12 @@
+require "flying_saucer/rufo"
+require "maruku"
+
+class Muse
+ def initialize(string, css = "")
+ @string, @css = Maruku.new(string).to_html, css
+ end
+
+ def to_pdf
+ ITextRenderer.new.make_pdf(@string)
+ end
+end
BIN  vendor/gems/cache/maruku-0.6.0.gem
Binary file not shown
BIN  vendor/gems/cache/syntax-1.0.0.gem
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.