I am attempting to encrypt the file that is generated by Itext:
def download str = Rjb::import("java.lang.String"); pw = Rjb::import("com.lowagie.text.pdf.PdfWriter") d = Rjb::import("com.lowagie.text.Document") ba = Rjb::import("java.io.ByteArrayOutputStream") b = ba.new() p = Rjb::import("com.lowagie.text.Paragraph") document = d.new() s = str.new("user") pwd = s.getBytes() writer = pw.getInstance(document, b) writer.setEncryption(pwd, pwd,2052,1); document.open() document.add(p.new("Hello!!!")) document.close() bytes = b.toByteArray() send_data(bytes, {:filename => "Letters For Printing.pdf", :type => "application/pdf"}) end
Every time I call the above method I get the error :
NoClassDefFoundError in LettersController#download
org/bouncycastle/asn1/ASN1OctetString
RAILS_ROOT: C:/ruby/letter4sure Application Trace | Framework Trace | Full Trace
app/controllers/letters_controller.rb:184:in `method_missing' app/controllers/letters_controller.rb:184:in `download' -e:2:in `load' -e:2
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' script/server:3 -e:2:in `load' -e:2
Request
Parameters:
{"id"=>"77"}
Show session dump