Saying something works and something else doesn't work isn't sufficient information. What I need is a StackTrace or some info on the so called corrupt PDF. I don't need this in my personal inbox, I want to see it on the mailing list. This being said, a first glance at your code says me neither solution can ever work (or only by accident) because you aren't closing the stamper.
br,
Bruno

Dilan wrote:

Thanks for your info,

In the code,

public ActionForward execute {
..

..

        OutputStream out = response.getOutputStream();

        int length = 0;
        int bufferLength = 1024*1024;
        byte[] buffer = new byte[bufferLength];
        InputStream input = pdfTransferForm(f, tto, type,out);
        while ((length = input.read(buffer)) != -1) {
                out.write(buffer, 0, length);
        }               

        input.close();
        ..
}
pdfTransferForm(TransferForm f, TenderOffer tto, boolean type) {
        PdfReader reader = new PdfReader(input);
        PdfStamper stamper = new PdfStamper(reader,out);
}
// works

And

public ActionForward execute {
..

..

        OutputStream out = response.getOutputStream();

        int length = 0;
        int bufferLength = 1024*1024;
        byte[] buffer = new byte[bufferLength];
        InputStream input = pdfTransferForm(f, tto, type,out);
        while ((length = input.read(buffer)) != -1) {
                out.write(buffer, 0, length);
        }               

        input.close();
        ..
}
pdfTransferForm(TransferForm f, TenderOffer tto, boolean type,OutputStream
out) {
        int bufferLength = 1024*1024;
        byte[] buffer = new byte[bufferLength];
        ByteArrayOutputStream bout = new
ByteArrayOutputStream(bufferLength);    
        PdfReader reader = new PdfReader(input);
        PdfStamper stamper = new PdfStamper(reader,bout);
}
// not working,


Can you able to give me any tips to fix it, I want it to be work as above,
where, setting the response.getOutputStream(); only within action map,
without passing to the method.
Regards,


Dilan



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to