i have this code:
require 'java'
require 'iText-5.0.6.jar'
module Pdf
include_package "com.itextpdf.text.pdf"
include_package "java.io"
def self.write
reader = PdfReader.new('application.pdf');
stamper = PdfStamper.new(reader, FileOutputStream.new('completed.pdf'))
form = stamper.acro_fields
puts "Form has these fields: #{form.fields.key_set.to_a}"
form.set_field("some_zipcode_field", "94115")
stamper.close
end
end
Pdf.write
in jRuby
and i want to translate to Ruby
, using rjb
anyone nows how can i do that?
It's possible to use libraries like iText from regular Ruby via "RJB", the Ruby-Java bridge. I do not know the proper sequence of calls in RJB to make that happen, but it is possible and I know of folks doing it.
An alternative would be to use the pure-Ruby "prawn" library, which would work the same on both JRuby and Ruby