>> require 'rjb'
=> ["RjbConf"]
>> Rjb::load('/var/www/html/renaissance/lib/iText.jar')
=> nil
>> FileOutputStream = Rjb::import('java.io.FileOutputStream')
=> #
>> Color = Rjb::import('java.awt.Color')
=> #
>> Element = Rjb::import('com.itextpdf.text.Element')
=> #
>> Document = Rjb::import('com.itextpdf.text.Document')
=> #
>> Font = Rjb::import('com.itextpdf.text.Font')
=> #
>> FontFactory = Rjb::import('com.itextpdf.text.FontFactory')
=> #
>> PageSize = Rjb::import('com.itextpdf.text.PageSize')
=> #
>> Paragraph = Rjb::import('com.itextpdf.text.Paragraph')
=> #
>> Phrase = Rjb::import('com.itextpdf.text.Phrase')
=> #
>> BaseFont = Rjb::import('com.itextpdf.text.pdf.BaseFont')
=> #
>> ColumnText = Rjb::import('com.itextpdf.text.pdf.ColumnText')
=> #
>> PdfPageEvent = Rjb::import('com.itextpdf.text.pdf.PdfPageEvent')
=> #
>> PdfPCell = Rjb::import('com.itextpdf.text.pdf.PdfPCell')
=> #
>> PdfContentByte = Rjb::import('com.itextpdf.text.pdf.PdfContentByte')
=> #
>> PdfPTable = Rjb::import('com.itextpdf.text.pdf.PdfPTable')
=> #
>> PdfWriter = Rjb::import('com.itextpdf.text.pdf.PdfWriter')
(irb):18: warning: already initialized constant NAME
=> #
>> PdfReader = Rjb::import('com.itextpdf.text.pdf.PdfReader')
=> #
>> pdfTest = PdfReader.new('/tmp/test.pdf')
=> #<#
>> pdfTest2 = PdfReader.new('/tmp/test2.pdf')
=> #<#
>> document = Document.new
=> #<#
>> pdf_writer = PdfWriter.getInstance(document, FileOutputStream.new("/tmp/merge.pdf"))
=> #<#
>> document.open
=> nil
>> cb = pdf_writer.getDirectContent()
=> #<#
>> document.newPage
=> true
>> page1 = pdf_writer.getImportedPage(pdfTest, 1)
=> #<#
>> cb.addTemplate(page1, 0, 0)
=> nil
>> document.newPage
=> true
>> page2 = pdf_writer.getImportedPage(pdfTest2, 1)
=> #<#
>> cb.addTemplate(page2, 0, 0)
=> nil
>> document.close
=> nil
>>
NOw have a two page pdf - hurrah (again)
No comments:
Post a Comment