[rjb-users] Two-Argument Contructor - Constructor not found

Wes Hays weshays at gmail.com
Wed Dec 12 09:56:56 EST 2007


Thank you very much Arton.  It is hard to beleive that after 6 hours I did not try that one and it should have been obvious :-)

You are truly a "Real Man of Genius" (Budweiser commercial)

-Wes

----- Original Message -----
From: "arton" <arton at e07.itscom.net>
To: rjb-users at rubyforge.org
Sent: Wednesday, December 12, 2007 3:58:31 AM (GMT-0800) America/Los_Angeles
Subject: Re: [rjb-users] Two-Argument Contructor - Constructor not found

Hi,

The new_with_sig method requires the exact signature.
According with http://www.docjar.com/html/api/com/lowagie/text/pdf/PdfStamper.java.html,
The constructor of PdfStamper is :
public PdfStamper(PdfReader reader, OutputStream os) throws DocumentException, IOException;
So you can write this as 
@stamper = @pdfStamper.new_with_sig("Lcom.lowagie.text.pdf.PdfReader;Ljava.io.OutputStream;", @reader, @baos);

Cheers

arton

On Tue, 11 Dec 2007 23:01:45 -0800 (PST)
Wes Hays <weshays at gmail.com>さん wrote:

> I have tried passing the two parameters to a two-argument constructor but it keeps failing.  I googled for the answer for 6 hours now but have not gotten any closer.  Can any see what I am doing wrong on the last line right before the error?
> 
> -----------------------------------
> require 'rjb' # Version 1.0.11
> Rjb::load(RAILS_ROOT + '/java/lib/iText-2.0.7.jar')
> 
> @byteArrayOutputStream = Rjb::import('java.io.ByteArrayOutputStream')
> @acroFields = Rjb::import('com.lowagie.text.pdf.AcroFields')
> @pdfReader  = Rjb::import('com.lowagie.text.pdf.PdfReader')
> @pdfStamper = Rjb::import('com.lowagie.text.pdf.PdfStamper')      
> @pdfFormField = Rjb::import('com.lowagie.text.pdf.PdfFormField')
> 
> @baos    = @byteArrayOutputStream.new
> @reader  = @pdfReader.new_with_sig('Ljava.lang.String;', RAILS_ROOT + '/java/data/regform.pdf')
> @stamper = @pdfStamper.new_with_sig("Lcom.lowagie.text.pdf.PdfReader;Ljava.io.ByteArrayOutputStream;", @reader, @baos)
> 
> RuntimeError: Constructor not found
>         from (irb):12:in `new_with_sig'
>         from (irb):12
> ----------------------------------
> 
> Thanks,
> -Wes
> 
> 
> _______________________________________________
> rjb-users mailing list
> rjb-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rjb-users

-- 
arton




More information about the rjb-users mailing list