1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
require "java"
require "rubygems"
import java.io.FileOutputStream
import java.io.IOException
import com.lowagie.text.Rectangle
import com.lowagie.text.Document
import com.lowagie.text.DocumentException
import com.lowagie.text.Paragraph
import com.lowagie.text.PageSize
import com.lowagie.text.pdf.PdfWriter
document = Document.new( PageSize::A4, 10, 10, 10, 10 )
document.addTitle( "Hello World" )
document.addSubject( "This examples shows how to add metadata" )
document.addCreator( "My program using iText" )
document.addAuthor( "Stephane Wirtel" )
pdfWriter = PdfWriter.getInstance( document, FileOutputStream.new( "helloworld.pdf" ) )
pdfWriter.setPdfVersion( PdfWriter::VERSION_1_6 )
document.open()
document.add( Paragraph.new( "Hello World" ) )
document.close() |
Partager