I am repeatedly getting this error when I open a pdf file created by my server.
UNABLE TO OPEN DOCUMENT
Fail to load document (error:3) 'file;///location/myfile.pdf'
My code to generate this file is this:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Document document = new Document(PageSize.A4);
PdfWriter.getInstance(document, baos);
document.open();
document.add(new Paragraph(new Date().toString()));
for(int j=0; j<100;j++){
document.add(new Paragraph("sagri your pdf is working well"));
document.add(Chunk.NEWLINE);
}
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma", "public");
response.setHeader("Contgent-disposition", "attachment; filename=\""
+ issueDate + ".pdf\"");
response.setContentType("application/pdf");
response.setContentLength(baos.size());
ServletOutputStream out = response.getOutputStream();
baos.writeTo(out);
out.flush();
document.close();
*************************************************************************
Instead of printing a line i wanted to add a image using
[[[[ byte[] imagedata = null;
try {
Blob image = page.getFile();
imagedata = image.getBytes(1, (int) image.length());
} catch (Exception e) {
log.error("Exception in getting the file", e);
return null;
}
return imagedata;
]]]]
byte[] data = ""> Image image2 = Image.getInstance(200, 150, 3, 8, data);
document.add(image2);
when I execute this code the generated exception shows unknown source for image2.
Exception:....................document.add(unknown source)..........
**************************************************************************
what way can we add data to a pdf that can be downloadable .
Here's a new way to find what you're looking for - Yahoo! Answers
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions