Created
April 17, 2009 07:04
-
-
Save jruby/96895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ ➔ gem maven itext itext 1.3.1 | |
Successfully installed itext-1.3.1-java | |
1 gem installed | |
~ ➔ cat hello_pdf.rb | |
require 'rubygems' | |
require 'itext' | |
import com.lowagie.text.pdf.PdfWriter | |
import com.lowagie.text.Document | |
import com.lowagie.text.Paragraph | |
file = File.open('Hello.pdf', 'w') | |
document = Document.new | |
writer = PdfWriter.get_instance(document, file.to_outputstream) | |
paragraph = Paragraph.new('Hello iText!') | |
document.open | |
document.add(paragraph) | |
document.close | |
~ ➔ jruby hello_pdf.rb | |
~ ➔ file Hello.pdf | |
Hello.pdf: PDF document, version 1.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment