Hello,
In this section of cord, I'm end up getting a corrupted pdf file, un
readable one, no any other java errors or stack trace,
However, if I pass the outputstream into the method that I created, it works
well, why cant I crate a pdf with a ByteArrayOutputStream first then, set
the response.getOutputStream() later?
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