Hi ,
this problem is solved using the code below:

response.reset();
        response.setHeader("Expires", "0")      response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
            response.setHeader("Pragma", "no-cache");
        response.setHeader("Content-disposition", "attachment; filename=\""
                + issueDate + ".pdf\"");
       
       
        response.setContentType("application/pdf");
  
        Document document = new Document(PageSize.A4);
       
        OutputStream out = response.getOutputStream();
        PdfWriter.getInstance(document, out);
       
        document.open();
       
        /*8
         * data holds blob retrieved
         */

            byte data[] = null;
          
            data = "">             Image image2 = Image.getInstance(data);
            document.add(image2);
            document.newPage();
            }
           
           
        document.close();
But this time I have a new problem.

once I open the document every thing is as expected. When I go down the pages and return back. Every thing is erased.

If I reopen this document the same thing is happenning.
Can any one please tell me if it is my Documents problem.
I am usin Evince Document Viewer that comes with linux.

Md Sagri <[EMAIL PROTECTED]> wrote:
Hi all,
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions


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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to