how to upload PDF content on server itext
hi i have beem trying to send the pdfcontent to the server, but i am
unable to see the content on the pdf file of the server.
while i download the pdf it is working fine.i dont think there is any
server issue as other application are also doing the same..
i am sending the base64. i am using the itext through javascript
below is my code in test.jsp
Document document = new Document();
try{
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PdfWriter.getInstance(document, buffer);
document.open();
int len = Integer.parseInt(totalImg);
for (int i=0; i<len; i++)
{
String data = request.getParameter("Image"+i);
int start = data.indexOf(",");
data = data.substring(start + 1);
Base64 base64obj= null;
Blob blob = new SerialBlob(base64obj.decode(data));
Image token = Image.getInstance(blob.getBytes(1, (int)
blob.length()));
int k = i+1;
document.add(new Paragraph("00"+k));
document.add(new Paragraph("00cvehgvjhwebhj wegb uywegyu gweyg"));
document.add(new Paragraph("00v nefrh iwehi ufewiuf iewfwie
gfiwegf iuwegfigweifu wefwefj lwekjfewfweofiwej "));
document.add(token);
}
document.close();
DataOutput dataOutput = new DataOutputStream(response.getOutputStream());
byte[] bytes = buffer.toByteArray();
response.setContentLength(bytes.length);
for(int i = 0; i < bytes.length; i++)
{
dataOutput.writeByte(bytes[i]);
}